scratch-www/test/unit/components/commenting-status.test.jsx

34 lines
1.1 KiB
React
Raw Normal View History

2020-10-08 15:12:09 -04:00
const React = require('react');
2023-01-06 15:55:16 -05:00
const {shallow} = require('enzyme');
2020-10-08 15:12:09 -04:00
const CommentingStatus = require('../../../src/components/commenting-status/commenting-status.jsx');
describe('CommentingStatus', () => {
test('Basic render', () => {
2023-01-06 15:55:16 -05:00
const component = shallow(
2020-10-08 15:12:09 -04:00
<CommentingStatus />
);
expect(component.find('div.commenting-status').exists()).toBe(true);
expect(component.find('img.comment-status-icon').exists()).toBe(true);
});
test('ClassNames added', () => {
2023-01-06 15:55:16 -05:00
const component = shallow(
2020-10-08 15:12:09 -04:00
<CommentingStatus
className="class1"
innerClassName="class2"
/>
);
expect(component.find('div.class1').exists()).toBe(true);
expect(component.find('div.class2').exists()).toBe(true);
});
test('Children added', () => {
2023-01-06 15:55:16 -05:00
const component = shallow(
2020-10-08 15:12:09 -04:00
<CommentingStatus>
<img className="myChildDiv" />
</CommentingStatus>
);
expect(component.find('img.myChildDiv').exists()).toBe(true);
});
});