All files / nexshop-web-contents/spec/action popup-spec.js

100% Statements 18/18
100% Branches 0/0
100% Functions 9/9
100% Lines 18/18
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 341x 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 {CLOSE_POPUP, closePopup, OPEN_POPUP, openPopup} from "../../src/action/popup";
 
describe('Popup Action Spec', () => {
    describe('openPopup', () => {
        it('has type as OPEN_POPUP', () => {
            expect(openPopup().type).to.equal(OPEN_POPUP);
        });
 
        it('has name as "your name"', () => {
            expect(openPopup('your name').name).to.equal('your name');
        });
 
        it('has name as "your name" and {top: 10}', () => {
            expect(openPopup('your name', {top: 10})).to.deep.equal({type:OPEN_POPUP, name: 'your name'});
        });
 
        it('has name as "your name" and {top: 10, left: 20}', () => {
            expect(openPopup('your name', {top: 10, left: 20})).to.deep.equal({type:OPEN_POPUP, name: 'your name'});
        });
 
        it('has name as "your name" and {top: 10, left: 20, uuid}', () => {
            expect(openPopup('your name', {top: 10, left: 20, uuid: '111'})).to.deep.equal({type:OPEN_POPUP, name:'your name', position: {top: 10, left: 20, uuid: '111'}});
        });
 
    });
 
    describe('closePopup', () => {
        it('has type as CLOSE_POPUP', () => {
            expect(closePopup().type).to.equal(CLOSE_POPUP);
        });
    });
});