@@ -15,6 +15,7 @@ import {
1515 useResetConnectorOffsets ,
1616 useUpdateConnectorState ,
1717} from 'lib/hooks/api/kafkaConnect' ;
18+ import { FullConnectorInfo } from 'generated-sources' ;
1819
1920const mockedUsedNavigate = jest . fn ( ) ;
2021const mockDelete = jest . fn ( ) ;
@@ -34,11 +35,14 @@ jest.mock('lib/hooks/api/kafkaConnect', () => ({
3435
3536const 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) =>
4751describe ( '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