kafka-ui/kafka-ui-react-app/src/components/Schemas/Details/__test__/LatestVersionItem.spec.tsx
Dekshut 9446d9c39d
[Fixes #1410] Edited using colors in styled components using our Theme (#1442)
* Edited using colors in syled components

* updated snapshots

* updated snapshots

* edited stylistic mistake

Co-authored-by: Oleg Shur <workshur@gmail.com>
2022-01-22 15:49:41 +02:00

47 lines
1.4 KiB
TypeScript

import React from 'react';
import { mount, shallow } from 'enzyme';
import LatestVersionItem from 'components/Schemas/Details/LatestVersion/LatestVersionItem';
import { ThemeProvider } from 'styled-components';
import theme from 'theme/theme';
import { jsonSchema, protoSchema } from './fixtures';
describe('LatestVersionItem', () => {
it('renders latest version of json schema', () => {
const wrapper = mount(
<ThemeProvider theme={theme}>
<LatestVersionItem schema={jsonSchema} />
</ThemeProvider>
);
expect(wrapper.find('div[data-testid="meta-data"]').length).toEqual(1);
expect(
wrapper.find('div[data-testid="meta-data"] > div:first-child > p').text()
).toEqual('1');
expect(wrapper.exists('EditorViewer')).toBeTruthy();
});
it('renders latest version of compatibility', () => {
const wrapper = mount(
<ThemeProvider theme={theme}>
<LatestVersionItem schema={protoSchema} />
</ThemeProvider>
);
expect(wrapper.find('div[data-testid="meta-data"]').length).toEqual(1);
expect(
wrapper.find('div[data-testid="meta-data"] > div:last-child > p').text()
).toEqual('BACKWARD');
expect(wrapper.exists('EditorViewer')).toBeTruthy();
});
it('matches snapshot', () => {
expect(
shallow(
<ThemeProvider theme={theme}>
<LatestVersionItem schema={jsonSchema} />
</ThemeProvider>
)
).toMatchSnapshot();
});
});