@@ -9,6 +9,7 @@ import fetchMock from 'fetch-mock';
99import { externalTopicPayload , topicConfigPayload } from 'lib/fixtures/topics' ;
1010import { CreateTopicMessage } from 'generated-sources' ;
1111import { TopicFormData , TopicFormDataRaw } from 'lib/interfaces/topic' ;
12+ import { QUERY_REFETCH_LIMITED_OPTIONS } from 'lib/constants' ;
1213
1314const clusterName = 'test-cluster' ;
1415const topicName = 'test-topic' ;
@@ -30,17 +31,37 @@ describe('Topics hooks', () => {
3031 const { result } = renderQueryHook ( ( ) => hooks . useTopics ( { clusterName } ) ) ;
3132 await expectQueryWorks ( mock , result ) ;
3233 } ) ;
33- it ( 'handles useTopicDetails' , async ( ) => {
34- const mock = fetchMock . getOnce ( topicPath , externalTopicPayload ) ;
35- const { result } = renderQueryHook ( ( ) =>
36- hooks . useTopicDetails ( topicParams )
37- ) ;
38- await expectQueryWorks ( mock , result ) ;
34+ describe ( 'useTopicDetails' , ( ) => {
35+ it ( 'handles useTopicDetails' , async ( ) => {
36+ const mock = fetchMock . getOnce ( topicPath , externalTopicPayload ) ;
37+ const { result } = renderQueryHook ( ( ) =>
38+ hooks . useTopicDetails ( topicParams )
39+ ) ;
40+ await expectQueryWorks ( mock , result ) ;
41+ } ) ;
42+ it ( 'handles useTopicDetails with queryOptions' , async ( ) => {
43+ const mock = fetchMock . getOnce ( topicPath , externalTopicPayload ) ;
44+ const { result } = renderQueryHook ( ( ) =>
45+ hooks . useTopicDetails ( topicParams , QUERY_REFETCH_LIMITED_OPTIONS )
46+ ) ;
47+ await expectQueryWorks ( mock , result ) ;
48+ } ) ;
3949 } ) ;
40- it ( 'handles useTopicConfig' , async ( ) => {
41- const mock = fetchMock . getOnce ( `${ topicPath } /config` , topicConfigPayload ) ;
42- const { result } = renderQueryHook ( ( ) => hooks . useTopicConfig ( topicParams ) ) ;
43- await expectQueryWorks ( mock , result ) ;
50+ describe ( 'useTopicConfig' , ( ) => {
51+ it ( 'handles useTopicConfig' , async ( ) => {
52+ const mock = fetchMock . getOnce ( `${ topicPath } /config` , topicConfigPayload ) ;
53+ const { result } = renderQueryHook ( ( ) =>
54+ hooks . useTopicConfig ( topicParams )
55+ ) ;
56+ await expectQueryWorks ( mock , result ) ;
57+ } ) ;
58+ it ( 'handles useTopicConfig with queryOptions' , async ( ) => {
59+ const mock = fetchMock . getOnce ( `${ topicPath } /config` , topicConfigPayload ) ;
60+ const { result } = renderQueryHook ( ( ) =>
61+ hooks . useTopicConfig ( topicParams , QUERY_REFETCH_LIMITED_OPTIONS )
62+ ) ;
63+ await expectQueryWorks ( mock , result ) ;
64+ } ) ;
4465 } ) ;
4566 it ( 'handles useTopicConsumerGroups' , async ( ) => {
4667 const mock = fetchMock . getOnce ( `${ topicPath } /consumer-groups` , [ ] ) ;
0 commit comments