src/reducers/__tests__/collections.spec.js
import { OrderedMap, fromJS } from 'immutable';
import { configLoaded } from '../../actions/config';
import collections from '../collections';
describe('collections', () => {
it('should handle an empty state', () => {
expect(
collections(undefined, {})
).toEqual(
null
);
});
it('should load the collections from the config', () => {
expect(
collections(undefined, configLoaded({
collections: [
{
name: 'posts',
folder: '_posts',
fields: [{ name: 'title', widget: 'string' }],
},
],
}))
).toEqual(
OrderedMap({
posts: fromJS({
name: 'posts',
folder: '_posts',
fields: [{ name: 'title', widget: 'string' }],
type: 'folder_based_collection',
}),
})
);
});
});