comelon
Version:
nicolive comment viewer on electron
45 lines (36 loc) • 1.21 kB
JavaScript
;
const chai = require('chai');
const {expect} = chai;
const {shallow, mount} = require('enzyme');
const {sandbox} = require('sinon');
chai.use(require('sinon-chai'));
describe('Footer', () => {
let React;
before(done => {
sandbox.create();
React = require('react');
require('../setup')();
done();
});
after(() => {
sandbox.restore();
});
it('should display Footer', () => {
const Footer = require('../../app/views/component/Footer');
const wrapper = shallow(<Footer />);
expect(wrapper.find(Footer)).to.have.length(0);
});
it('if toggled should be set mail option of state', () => {
const Footer = require('../../app/views/component/Footer');
const wrapper = mount(<Footer />);
wrapper.component.getInstance().handleToggle();
expect(wrapper.state().mail).to.equal('184');
});
it('if input text should be change text of state', () => {
const Footer = require('../../app/views/component/Footer');
const wrapper = mount(<Footer />);
let event = {target: { value: 'sample comment' }};
wrapper.component.getInstance().changeComment(event);
expect(wrapper.state().comment).to.equal('sample comment');
});
});