All files / nexshop-web-contents/spec/reducer floating-view-spec.js

100% Statements 20/20
100% Branches 0/0
100% Functions 8/8
100% Lines 20/20
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 30 31 32 33 34 35 361x 1x 1x 1x   1x 1x 1x 1x   1x     1x 1x   1x       1x 1x 1x   1x       1x 1x 1x   1x      
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'});
        });
    });
});