Skip to content

Commit 9508cc4

Browse files
committed
pretty
1 parent 21b86d4 commit 9508cc4

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

client/src/components/__tests__/ResourcesTab.test.tsx

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jest.mock("../JsonView", () => {
2020
});
2121

2222
jest.mock("@/components/ui/combobox", () => ({
23-
Combobox: ({ id, value, onChange, placeholder }: {
23+
Combobox: ({
24+
id,
25+
value,
26+
onChange,
27+
placeholder,
28+
}: {
2429
id: string;
2530
value: string;
2631
onChange: (value: string) => void;
@@ -37,7 +42,10 @@ jest.mock("@/components/ui/combobox", () => ({
3742
}));
3843

3944
jest.mock("@/components/ui/label", () => ({
40-
Label: ({ htmlFor, children }: {
45+
Label: ({
46+
htmlFor,
47+
children,
48+
}: {
4149
htmlFor: string;
4250
children: React.ReactNode;
4351
}) => (
@@ -48,7 +56,12 @@ jest.mock("@/components/ui/label", () => ({
4856
}));
4957

5058
jest.mock("@/components/ui/button", () => ({
51-
Button: ({ children, onClick, disabled, ...props }: {
59+
Button: ({
60+
children,
61+
onClick,
62+
disabled,
63+
...props
64+
}: {
5265
children: React.ReactNode;
5366
onClick?: () => void;
5467
disabled?: boolean;
@@ -139,7 +152,9 @@ describe("ResourcesTab - Template Query Parameters", () => {
139152
// Click on the resource template to select it
140153
fireEvent.click(screen.getByText("Users API"));
141154

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();
143158
});
144159

145160
it("should handle template value changes", () => {
@@ -180,16 +195,18 @@ describe("ResourcesTab - Template Query Parameters", () => {
180195
// Click Read Resource button
181196
const readResourceButton = screen.getByText("Read Resource");
182197
expect(readResourceButton).not.toBeDisabled();
183-
198+
184199
fireEvent.click(readResourceButton);
185200

186201
// 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+
189206
// Verify that setSelectedResource was called with the expanded resource
190207
expect(mockSetSelectedResource).toHaveBeenCalledWith({
191208
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",
193210
});
194211
});
195212

@@ -217,7 +234,7 @@ describe("ResourcesTab - Template Query Parameters", () => {
217234
// Read Resource button should be enabled with partial values
218235
const readResourceButton = screen.getByText("Read Resource");
219236
expect(readResourceButton).not.toBeDisabled();
220-
237+
221238
fireEvent.click(readResourceButton);
222239

223240
// Should expand with only the provided values
@@ -237,7 +254,9 @@ describe("ResourcesTab - Template Query Parameters", () => {
237254
fireEvent.click(screen.getByText("Read Resource"));
238255

239256
// 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+
);
241260
});
242261

243262
it("should clear template values when switching between templates", () => {
@@ -248,7 +267,7 @@ describe("ResourcesTab - Template Query Parameters", () => {
248267
};
249268

250269
renderResourcesTab({
251-
resourceTemplates: [mockResourceTemplate, anotherTemplate]
270+
resourceTemplates: [mockResourceTemplate, anotherTemplate],
252271
});
253272

254273
// Select first template and fill values
@@ -267,10 +286,10 @@ describe("ResourcesTab - Template Query Parameters", () => {
267286

268287
it("should display resource content when a resource is selected", () => {
269288
const resourceContent = '{"users": [{"id": 1, "name": "John"}]}';
270-
289+
271290
renderResourcesTab({
272291
selectedResource: mockResource,
273-
resourceContent: resourceContent
292+
resourceContent: resourceContent,
274293
});
275294

276295
expect(screen.getByTestId("json-view")).toBeInTheDocument();
@@ -280,6 +299,10 @@ describe("ResourcesTab - Template Query Parameters", () => {
280299
it("should show alert when no resource or template is selected", () => {
281300
renderResourcesTab();
282301

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();
284307
});
285308
});

0 commit comments

Comments
 (0)