File size: 720 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { MEDIA_MODAL_VIEW_SET } from 'calypso/state/action-types';
import { ModalViews } from '../constants';
import reducer, { view } from '../reducer';
describe( 'reducer', () => {
test( 'should export expected reducer keys', () => {
expect( Object.keys( reducer( undefined, {} ) ) ).toEqual(
expect.arrayContaining( [ 'view' ] )
);
} );
describe( 'view()', () => {
test( 'should default to null', () => {
const state = view( undefined, {} );
expect( state ).toBeNull();
} );
test( 'should track current view', () => {
const state = view( undefined, {
type: MEDIA_MODAL_VIEW_SET,
view: ModalViews.DETAIL,
} );
expect( state ).toEqual( ModalViews.DETAIL );
} );
} );
} );
|