All files / nexshop-web-contents/spec/component/preview playlist-preview-header-view-spec.js

100% Statements 14/14
100% Branches 0/0
100% Functions 4/4
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 251x 1x 1x 1x 1x   1x       1x 2x 2x     1x 1x     1x 1x   1x    
import React from 'react';
import {expect} from 'chai';
import {shallow} from 'enzyme';
import sinon from "sinon";
import PlaylistPreviewHeaderView from "../../../src/component/preview/playlist/playlist-preview-header-view";
 
describe('Playlist Preview Header View Spec', () => {
    let wrapper;
    let spyOnClickClose;
 
    beforeEach(() => {
        spyOnClickClose = sinon.spy();
        wrapper = shallow(<PlaylistPreviewHeaderView name={'X-Men Begins'} onClickClose={spyOnClickClose}/>);
    });
 
    it('has name as playlist-title ', () => {
        expect(wrapper.find('.preview-header__title').text()).to.equal('X-Men Begins');
    });
 
    it('calls props.onClickClose when click close button', () => {
        wrapper.find('.preview-header-close').simulate('click');
 
        expect(spyOnClickClose.called).to.be.true;
    });
});