|
@@ -4,6 +4,7 @@ import ListItem from 'components/ConsumerGroups/List/ListItem';
|
|
|
import { ThemeProvider } from 'styled-components';
|
|
|
import theme from 'theme/theme';
|
|
|
import { StaticRouter } from 'react-router';
|
|
|
+import { ConsumerGroupState, ConsumerGroup } from 'generated-sources';
|
|
|
|
|
|
describe('List', () => {
|
|
|
const mockConsumerGroup = {
|
|
@@ -40,7 +41,63 @@ describe('List', () => {
|
|
|
</StaticRouter>
|
|
|
);
|
|
|
|
|
|
+ const setupWrapper = (consumerGroup: ConsumerGroup) => (
|
|
|
+ <StaticRouter>
|
|
|
+ <ThemeProvider theme={theme}>
|
|
|
+ <table>
|
|
|
+ <tbody>
|
|
|
+ <ListItem consumerGroup={consumerGroup} />
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </ThemeProvider>
|
|
|
+ </StaticRouter>
|
|
|
+ );
|
|
|
+
|
|
|
it('render empty ListItem', () => {
|
|
|
expect(component.exists('tr')).toBeTruthy();
|
|
|
});
|
|
|
+
|
|
|
+ it('renders item with stable status', () => {
|
|
|
+ const wrapper = mount(
|
|
|
+ setupWrapper({
|
|
|
+ ...mockConsumerGroup,
|
|
|
+ state: ConsumerGroupState.STABLE,
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ expect(wrapper.find('td').at(5).text()).toBe(ConsumerGroupState.STABLE);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('renders item with dead status', () => {
|
|
|
+ const wrapper = mount(
|
|
|
+ setupWrapper({
|
|
|
+ ...mockConsumerGroup,
|
|
|
+ state: ConsumerGroupState.DEAD,
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ expect(wrapper.find('td').at(5).text()).toBe(ConsumerGroupState.DEAD);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('renders item with empty status', () => {
|
|
|
+ const wrapper = mount(
|
|
|
+ setupWrapper({
|
|
|
+ ...mockConsumerGroup,
|
|
|
+ state: ConsumerGroupState.EMPTY,
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ expect(wrapper.find('td').at(5).text()).toBe(ConsumerGroupState.EMPTY);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('renders item with empty-string status', () => {
|
|
|
+ const wrapper = mount(
|
|
|
+ setupWrapper({
|
|
|
+ ...mockConsumerGroup,
|
|
|
+ state: ConsumerGroupState.UNKNOWN,
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ expect(wrapper.find('td').at(5).text()).toBe(ConsumerGroupState.UNKNOWN);
|
|
|
+ });
|
|
|
});
|