* adding more tests - covers article.jsx and elements created from its props and state - added png as static file that needs stubbing * video + channelDetails test coverage * chat + channels tests * channels cc refactor * yarn install * update snapshot and string spacing * chat.jsx test mostly tests rendering elements - does not test imported components, as those are already tested separately - does not imported functions from actions or utils as those will be tested separately as well * cleaning up - mocked response with flush promises for state/component to reflect appropriate changes * snapshot updates
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { h } from 'preact';
|
||
import render from 'preact-render-to-json';
|
||
import { shallow } from 'preact-render-spy';
|
||
import Content from '../content';
|
||
|
||
const getContent = () => (
|
||
<Content
|
||
onTriggerContent={false}
|
||
resource={{ type_of: 'loading-user' }}
|
||
activeChannelId={12345}
|
||
pusherKey="ASDFGHJKL"
|
||
githubToken=""
|
||
/>
|
||
);
|
||
|
||
describe('<Content />', () => {
|
||
describe('as loading-user', () => {
|
||
it('should render and test snapshot', () => {
|
||
const tree = render(getContent());
|
||
expect(tree).toMatchSnapshot();
|
||
});
|
||
it('should have proper elements, attributes and content', () => {
|
||
const context = shallow(getContent());
|
||
expect(
|
||
context.find('.activechatchannel__activecontent').exists(),
|
||
).toEqual(true);
|
||
const exitButton = context.find(
|
||
'.activechatchannel__activecontentexitbutton',
|
||
);
|
||
expect(exitButton.exists()).toEqual(true);
|
||
expect(exitButton.attr('data-content')).toEqual('exit');
|
||
expect(exitButton.text()).toEqual('×');
|
||
});
|
||
});
|
||
/*
|
||
testing only as loading user since components that Content uses
|
||
are independently tested
|
||
*/
|
||
});
|