comelon
Version:
nicolive comment viewer on electron
43 lines (36 loc) • 1.03 kB
JavaScript
;
const chai = require('chai');
const {expect} = chai;
const {shallow} = require('enzyme');
const {sandbox} = require('sinon');
chai.use(require('sinon-chai'));
describe('CommentTable', () => {
let Immutable;
let React;
let sampleComments;
before(() => {
sandbox.create();
Immutable = require('immutable');
React = require('react');
sampleComments = [
Immutable.fromJS({
attr: {user_id: 4197870, no : 1},
text: 'sample comment1'
}),
Immutable.fromJS({
attr: {user_id: 4197870, no : 1},
text: 'sample comment2'
})
];
});
after(() => {
sandbox.restore();
});
it('should display Comment in CommentTable ', () => {
require('../setup')();
const CommentTable = require('../../app/views/component/CommentTable');
const Comment = require('../../app/views/component/Comment');
const wrapper = shallow(<CommentTable comments={sampleComments} />);
expect(wrapper.find(Comment).length).to.equal(2);
});
});