docbrown/app/javascript/chat/__tests__/channelButton.test.jsx
Nick Taylor 653ec12300
Upgrade to Preact 10.4.4 (#8739)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-06-18 10:07:17 -04:00

36 lines
1.1 KiB
JavaScript

import { h } from 'preact';
import { render } from '@testing-library/preact';
import { axe } from 'jest-axe';
import ChannelButton from '../components/channelButton';
const getChannel = () => {
return {
channel_name: 'test',
channel_color: '#00FFFF',
channel_type: 'invite_only',
channel_modified_slug: '@test34',
id: 34,
chat_channel_id: 23,
status: 'active',
};
};
describe('<ChannelButton />', () => {
it('should have no a11y violations', async () => {
const { container } = render(<ChannelButton channel={getChannel()} />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
it('should render', () => {
const { getByText } = render(<ChannelButton channel={getChannel()} />);
const button = getByText('test');
expect(button.dataset.channelSlug).toEqual('@test34');
expect(button.dataset.channelId).toEqual('23');
expect(button.dataset.channelStatus).toEqual('active');
expect(button.dataset.channelName).toEqual('test');
expect(button.dataset.content).toEqual('sidecar-channel-request');
});
});