This commit is contained in:
Smbat Siradeghyan 2022-05-16 18:03:32 +04:00 committed by GitHub
parent 13791d0401
commit 527df864bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,38 @@
import React from 'react';
import { Route, Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { clusterKsqlDbPath } from 'lib/paths';
import { render } from 'lib/testHelpers';
import { screen } from '@testing-library/dom';
import ListItem from 'components/KsqlDb/List/ListItem';
const history = createMemoryHistory();
const clusterName = 'local';
const renderComponent = ({
accessors,
data,
}: {
accessors: string[];
data: Record<string, string>;
}) => {
history.push(clusterKsqlDbPath(clusterName));
render(
<Router history={history}>
<Route path={clusterKsqlDbPath(':clusterName')}>
<ListItem accessors={accessors} data={data} />
</Route>
</Router>
);
};
describe('KsqlDb List Item', () => {
it('renders placeholder on one data', async () => {
renderComponent({
accessors: ['accessors'],
data: { accessors: 'accessors text' },
});
expect(screen.getByText('accessors text')).toBeInTheDocument();
});
});