mirror of
https://github.com/thumbsup/thumbsup
synced 2024-11-11 07:10:26 +00:00
3e64d2ab38
- for easier unit testing - to enable input filtering (e.g. only include photos with this keyword)
33 lines
997 B
JavaScript
33 lines
997 B
JavaScript
var should = require('should/as-function')
|
|
var mapper = require('../../src/input/mapper.js')
|
|
var fixtures = require('../fixtures.js')
|
|
|
|
describe('mapper', function () {
|
|
it('can create a path mapper', function () {
|
|
const map = mapper.create({albumsFrom: 'folders'})
|
|
const entry = fixtures.photo({
|
|
path: 'holidays/canada/IMG_0001.jpg'
|
|
})
|
|
should(map(entry)).eql('holidays/canada')
|
|
})
|
|
it('can create a default date mapper', function () {
|
|
const map = mapper.create({albumsFrom: 'date'})
|
|
const entry = fixtures.photo({
|
|
path: 'holidays/canada/IMG_0001.jpg',
|
|
date: '2016:07:14 12:07:41'
|
|
})
|
|
should(map(entry)).eql('2016 July')
|
|
})
|
|
it('can create a custom date mapper', function () {
|
|
const map = mapper.create({
|
|
albumsFrom: 'date',
|
|
albumsDateFormat: 'YYYY/MM'
|
|
})
|
|
const entry = fixtures.photo({
|
|
path: 'holidays/canada/IMG_0001.jpg',
|
|
date: '2016:07:14 12:07:41'
|
|
})
|
|
should(map(entry)).eql('2016/07')
|
|
})
|
|
})
|