Skip to content

Commit 19c0a0d

Browse files
committed
test: injectSchemas with imported parameter schema
1 parent 6459ef3 commit 19c0a0d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/core/injectSchemas.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,32 @@ describe("injectSchemas", () => {
5353
});
5454
`);
5555
});
56+
57+
it("should wrap the imported queryParams schema name with global.schemas", () => {
58+
const code = `
59+
const { GET } = defineRoute({
60+
queryParams: User,
61+
});
62+
`;
63+
const output = injectSchemas(code, "User");
64+
expect(output).toBe(`
65+
const { GET } = defineRoute({
66+
queryParams: global.schemas["User"],
67+
});
68+
`);
69+
});
70+
71+
it("should wrap the imported pathParams schema name with global.schemas", () => {
72+
const code = `
73+
const { GET } = defineRoute({
74+
pathParams: User,
75+
});
76+
`;
77+
const output = injectSchemas(code, "User");
78+
expect(output).toBe(`
79+
const { GET } = defineRoute({
80+
pathParams: global.schemas["User"],
81+
});
82+
`);
83+
});
5684
});

0 commit comments

Comments
 (0)