Skip to content

Commit 353bbc2

Browse files
committed
FE: Fix test
1 parent 9ea7766 commit 353bbc2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

frontend/src/components/ClusterPage/__tests__/ClusterPage.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe('ClusterPage', () => {
5252
const renderComponent = async (pathname: string, payload: Cluster[] = []) => {
5353
(useClusters as jest.Mock).mockImplementation(() => ({
5454
data: payload,
55+
isFetched: true,
5556
}));
5657
await render(
5758
<WithRoute path={`${clusterPath()}/*`}>

frontend/src/components/Connect/List/__tests__/List.spec.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
useResetConnectorOffsets,
1616
useUpdateConnectorState,
1717
} from 'lib/hooks/api/kafkaConnect';
18+
import { FullConnectorInfo } from 'generated-sources';
1819

1920
const mockedUsedNavigate = jest.fn();
2021
const mockDelete = jest.fn();
@@ -34,11 +35,14 @@ jest.mock('lib/hooks/api/kafkaConnect', () => ({
3435

3536
const clusterName = 'local';
3637

37-
const renderComponent = (contextValue: ContextProps = initialValue) =>
38+
const renderComponent = (
39+
contextValue: ContextProps = initialValue,
40+
data: FullConnectorInfo[] = connectors
41+
) =>
3842
render(
3943
<ClusterContext.Provider value={contextValue}>
4044
<WithRoute path={clusterConnectorsPath()}>
41-
<List />
45+
<List connectors={data} />
4246
</WithRoute>
4347
</ClusterContext.Provider>,
4448
{ initialEntries: [clusterConnectorsPath(clusterName)] }
@@ -47,9 +51,6 @@ const renderComponent = (contextValue: ContextProps = initialValue) =>
4751
describe('Connectors List', () => {
4852
describe('when the connectors are loaded', () => {
4953
beforeEach(() => {
50-
(useConnectors as jest.Mock).mockImplementation(() => ({
51-
data: connectors,
52-
}));
5354
const restartConnector = jest.fn();
5455
(useUpdateConnectorState as jest.Mock).mockImplementation(() => ({
5556
mutateAsync: restartConnector,
@@ -84,7 +85,7 @@ describe('Connectors List', () => {
8485
});
8586

8687
it('renders empty table', async () => {
87-
renderComponent();
88+
renderComponent(undefined, []);
8889
expect(screen.getByRole('table')).toBeInTheDocument();
8990
expect(
9091
screen.getByRole('row', { name: 'No connectors found' })

0 commit comments

Comments
 (0)