mirror of https://github.com/thumbsup/thumbsup
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
997 B
JavaScript
33 lines
997 B
JavaScript
8 years ago
|
var should = require('should/as-function')
|
||
7 years ago
|
var mapper = require('../../src/input/mapper.js')
|
||
8 years ago
|
var fixtures = require('../fixtures.js')
|
||
|
|
||
|
describe('mapper', function () {
|
||
|
it('can create a path mapper', function () {
|
||
|
const map = mapper.create({albumsFrom: 'folders'})
|
||
7 years ago
|
const entry = fixtures.photo({
|
||
8 years ago
|
path: 'holidays/canada/IMG_0001.jpg'
|
||
|
})
|
||
7 years ago
|
should(map(entry)).eql('holidays/canada')
|
||
8 years ago
|
})
|
||
|
it('can create a default date mapper', function () {
|
||
|
const map = mapper.create({albumsFrom: 'date'})
|
||
7 years ago
|
const entry = fixtures.photo({
|
||
8 years ago
|
path: 'holidays/canada/IMG_0001.jpg',
|
||
7 years ago
|
date: '2016:07:14 12:07:41'
|
||
8 years ago
|
})
|
||
7 years ago
|
should(map(entry)).eql('2016 July')
|
||
8 years ago
|
})
|
||
|
it('can create a custom date mapper', function () {
|
||
|
const map = mapper.create({
|
||
|
albumsFrom: 'date',
|
||
|
albumsDateFormat: 'YYYY/MM'
|
||
|
})
|
||
7 years ago
|
const entry = fixtures.photo({
|
||
8 years ago
|
path: 'holidays/canada/IMG_0001.jpg',
|
||
7 years ago
|
date: '2016:07:14 12:07:41'
|
||
8 years ago
|
})
|
||
7 years ago
|
should(map(entry)).eql('2016/07')
|
||
8 years ago
|
})
|
||
|
})
|