@@ -20,7 +20,12 @@ jest.mock("../JsonView", () => {
20
20
} ) ;
21
21
22
22
jest . mock ( "@/components/ui/combobox" , ( ) => ( {
23
- Combobox : ( { id, value, onChange, placeholder } : {
23
+ Combobox : ( {
24
+ id,
25
+ value,
26
+ onChange,
27
+ placeholder,
28
+ } : {
24
29
id : string ;
25
30
value : string ;
26
31
onChange : ( value : string ) => void ;
@@ -37,7 +42,10 @@ jest.mock("@/components/ui/combobox", () => ({
37
42
} ) ) ;
38
43
39
44
jest . mock ( "@/components/ui/label" , ( ) => ( {
40
- Label : ( { htmlFor, children } : {
45
+ Label : ( {
46
+ htmlFor,
47
+ children,
48
+ } : {
41
49
htmlFor : string ;
42
50
children : React . ReactNode ;
43
51
} ) => (
@@ -48,7 +56,12 @@ jest.mock("@/components/ui/label", () => ({
48
56
} ) ) ;
49
57
50
58
jest . mock ( "@/components/ui/button" , ( ) => ( {
51
- Button : ( { children, onClick, disabled, ...props } : {
59
+ Button : ( {
60
+ children,
61
+ onClick,
62
+ disabled,
63
+ ...props
64
+ } : {
52
65
children : React . ReactNode ;
53
66
onClick ?: ( ) => void ;
54
67
disabled ?: boolean ;
@@ -139,7 +152,9 @@ describe("ResourcesTab - Template Query Parameters", () => {
139
152
// Click on the resource template to select it
140
153
fireEvent . click ( screen . getByText ( "Users API" ) ) ;
141
154
142
- expect ( screen . getByText ( "Fetch users with optional filtering and pagination" ) ) . toBeInTheDocument ( ) ;
155
+ expect (
156
+ screen . getByText ( "Fetch users with optional filtering and pagination" ) ,
157
+ ) . toBeInTheDocument ( ) ;
143
158
} ) ;
144
159
145
160
it ( "should handle template value changes" , ( ) => {
@@ -180,16 +195,18 @@ describe("ResourcesTab - Template Query Parameters", () => {
180
195
// Click Read Resource button
181
196
const readResourceButton = screen . getByText ( "Read Resource" ) ;
182
197
expect ( readResourceButton ) . not . toBeDisabled ( ) ;
183
-
198
+
184
199
fireEvent . click ( readResourceButton ) ;
185
200
186
201
// Verify that readResource was called with the expanded URI
187
- expect ( mockReadResource ) . toHaveBeenCalledWith ( "test://users?name=john&limit=10&offset=0" ) ;
188
-
202
+ expect ( mockReadResource ) . toHaveBeenCalledWith (
203
+ "test://users?name=john&limit=10&offset=0" ,
204
+ ) ;
205
+
189
206
// Verify that setSelectedResource was called with the expanded resource
190
207
expect ( mockSetSelectedResource ) . toHaveBeenCalledWith ( {
191
208
uri : "test://users?name=john&limit=10&offset=0" ,
192
- name : "test://users?name=john&limit=10&offset=0"
209
+ name : "test://users?name=john&limit=10&offset=0" ,
193
210
} ) ;
194
211
} ) ;
195
212
@@ -217,7 +234,7 @@ describe("ResourcesTab - Template Query Parameters", () => {
217
234
// Read Resource button should be enabled with partial values
218
235
const readResourceButton = screen . getByText ( "Read Resource" ) ;
219
236
expect ( readResourceButton ) . not . toBeDisabled ( ) ;
220
-
237
+
221
238
fireEvent . click ( readResourceButton ) ;
222
239
223
240
// Should expand with only the provided values
@@ -237,7 +254,9 @@ describe("ResourcesTab - Template Query Parameters", () => {
237
254
fireEvent . click ( screen . getByText ( "Read Resource" ) ) ;
238
255
239
256
// Should properly encode special characters
240
- expect ( mockReadResource ) . toHaveBeenCalledWith ( "test://users?name=john%20doe" ) ;
257
+ expect ( mockReadResource ) . toHaveBeenCalledWith (
258
+ "test://users?name=john%20doe" ,
259
+ ) ;
241
260
} ) ;
242
261
243
262
it ( "should clear template values when switching between templates" , ( ) => {
@@ -248,7 +267,7 @@ describe("ResourcesTab - Template Query Parameters", () => {
248
267
} ;
249
268
250
269
renderResourcesTab ( {
251
- resourceTemplates : [ mockResourceTemplate , anotherTemplate ]
270
+ resourceTemplates : [ mockResourceTemplate , anotherTemplate ] ,
252
271
} ) ;
253
272
254
273
// Select first template and fill values
@@ -267,10 +286,10 @@ describe("ResourcesTab - Template Query Parameters", () => {
267
286
268
287
it ( "should display resource content when a resource is selected" , ( ) => {
269
288
const resourceContent = '{"users": [{"id": 1, "name": "John"}]}' ;
270
-
289
+
271
290
renderResourcesTab ( {
272
291
selectedResource : mockResource ,
273
- resourceContent : resourceContent
292
+ resourceContent : resourceContent ,
274
293
} ) ;
275
294
276
295
expect ( screen . getByTestId ( "json-view" ) ) . toBeInTheDocument ( ) ;
@@ -280,6 +299,10 @@ describe("ResourcesTab - Template Query Parameters", () => {
280
299
it ( "should show alert when no resource or template is selected" , ( ) => {
281
300
renderResourcesTab ( ) ;
282
301
283
- expect ( screen . getByText ( "Select a resource or template from the list to view its contents" ) ) . toBeInTheDocument ( ) ;
302
+ expect (
303
+ screen . getByText (
304
+ "Select a resource or template from the list to view its contents" ,
305
+ ) ,
306
+ ) . toBeInTheDocument ( ) ;
284
307
} ) ;
285
308
} ) ;
0 commit comments