File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments