UNPKG

nexshop-web-contents

Version:

Nexshop Web Contents Project

36 lines (28 loc) 1.3 kB
import React from 'react'; import {expect} from 'chai'; import {floatingView} from "../../src/reducer/floating-view"; import {CLOSE_FLOATING_VIEW, OPEN_FLOATING_VIEW} from "../../src/action/floating-view"; describe('Floating View Reducer Spec', () => { describe('OPEN FLOATING VIEW Action', () => { it('changes "visibility" state as true', () => { let nextState = floatingView({}, {type: OPEN_FLOATING_VIEW}); expect(nextState.visibility).to.be.true; }); it('changes "visibility" state as true when initial state is undefined', () => { let nextState = floatingView(undefined, {type: OPEN_FLOATING_VIEW}); expect(nextState.visibility).to.be.true; }); }); describe('CLOSE FLOATING VIEW Action', () => { it('changes "visibility" state as false', () => { let nextState = floatingView({visibility: true}, {type: CLOSE_FLOATING_VIEW}); expect(nextState.visibility).to.be.false; }); }); describe('Default Action', () => { it('returns initialState', () => { let nextState = floatingView({visibility: 'default visibility'}, {type: ''}); expect(nextState).to.deep.equal({visibility: 'default visibility'}); }); }); });