@@ -15,7 +15,7 @@ describe('myzod', () => {
1515 }
1616 ` ,
1717 [
18- 'export const PrimitiveInputSchema: myzod.Type<PrimitiveInput>' ,
18+ 'export function PrimitiveInputSchema() : myzod.Type<PrimitiveInput> { ' ,
1919 'a: myzod.string()' ,
2020 'b: myzod.string()' ,
2121 'c: myzod.boolean()' ,
@@ -36,7 +36,7 @@ describe('myzod', () => {
3636 }
3737 ` ,
3838 [
39- 'export const PrimitiveInputSchema: myzod.Type<PrimitiveInput>' ,
39+ 'export function PrimitiveInputSchema() : myzod.Type<PrimitiveInput> { ' ,
4040 // alphabet order
4141 'a: myzod.string().optional().nullable(),' ,
4242 'b: myzod.string().optional().nullable(),' ,
@@ -58,7 +58,7 @@ describe('myzod', () => {
5858 }
5959 ` ,
6060 [
61- 'export const ArrayInputSchema: myzod.Type<ArrayInput>' ,
61+ 'export function ArrayInputSchema() : myzod.Type<ArrayInput> { ' ,
6262 'a: myzod.array(myzod.string().nullable()).optional().nullable(),' ,
6363 'b: myzod.array(myzod.string()).optional().nullable(),' ,
6464 'c: myzod.array(myzod.string()),' ,
@@ -81,11 +81,11 @@ describe('myzod', () => {
8181 }
8282 ` ,
8383 [
84- 'export const AInputSchema: myzod.Type<AInput>' ,
84+ 'export function AInputSchema() : myzod.Type<AInput> { ' ,
8585 'b: myzod.lazy(() => BInputSchema())' ,
86- 'export const BInputSchema: myzod.Type<BInput>' ,
86+ 'export function BInputSchema() : myzod.Type<BInput> { ' ,
8787 'c: myzod.lazy(() => CInputSchema())' ,
88- 'export const CInputSchema: myzod.Type<CInput>' ,
88+ 'export function CInputSchema() : myzod.Type<CInput> { ' ,
8989 'a: myzod.lazy(() => AInputSchema())' ,
9090 ] ,
9191 ] ,
@@ -98,7 +98,7 @@ describe('myzod', () => {
9898 }
9999 ` ,
100100 [
101- 'export const NestedInputSchema: myzod.Type<NestedInput>' ,
101+ 'export function NestedInputSchema() : myzod.Type<NestedInput> { ' ,
102102 'child: myzod.lazy(() => NestedInputSchema().optional().nullable()),' ,
103103 'childrens: myzod.array(myzod.lazy(() => NestedInputSchema().nullable())).optional().nullable()' ,
104104 ] ,
@@ -116,7 +116,7 @@ describe('myzod', () => {
116116 ` ,
117117 [
118118 'export const PageTypeSchema = myzod.enum(PageType)' ,
119- 'export const PageInputSchema: myzod.Type<PageInput>' ,
119+ 'export function PageInputSchema() : myzod.Type<PageInput> { ' ,
120120 'pageType: PageTypeSchema' ,
121121 ] ,
122122 ] ,
@@ -136,7 +136,7 @@ describe('myzod', () => {
136136 scalar URL # unknown scalar, should be any (definedNonNullAnySchema)
137137 ` ,
138138 [
139- 'export const HttpInputSchema: myzod.Type<HttpInput>' ,
139+ 'export function HttpInputSchema() : myzod.Type<HttpInput> { ' ,
140140 'export const HttpMethodSchema = myzod.enum(HttpMethod)' ,
141141 'method: HttpMethodSchema' ,
142142 'url: definedNonNullAnySchema' ,
@@ -145,7 +145,7 @@ describe('myzod', () => {
145145 ] ) ( '%s' , async ( _ , textSchema , wantContains ) => {
146146 const schema = buildSchema ( textSchema ) ;
147147 const result = await plugin ( schema , [ ] , { schema : 'myzod' } , { } ) ;
148- expect ( result . prepend ) . toContain ( "import myzod from 'myzod'" ) ;
148+ expect ( result . prepend ) . toContain ( "import * as myzod from 'myzod'" ) ;
149149
150150 for ( const wantContain of wantContains ) {
151151 expect ( result . content ) . toContain ( wantContain ) ;
@@ -236,7 +236,7 @@ describe('myzod', () => {
236236 { }
237237 ) ;
238238 const wantContains = [
239- 'export const PrimitiveInputSchema: myzod.Type<PrimitiveInput>' ,
239+ 'export function PrimitiveInputSchema() : myzod.Type<PrimitiveInput> { ' ,
240240 'a: myzod.string().min(1),' ,
241241 'b: myzod.string().min(1),' ,
242242 'c: myzod.boolean(),' ,
@@ -271,7 +271,7 @@ describe('myzod', () => {
271271 { }
272272 ) ;
273273 const wantContains = [
274- 'export const ScalarsInputSchema: myzod.Type<ScalarsInput>' ,
274+ 'export function ScalarsInputSchema() : myzod.Type<ScalarsInput> { ' ,
275275 'date: myzod.date(),' ,
276276 'email: myzod.string()' , // TODO: Test implementation
277277 'str: myzod.string()' ,
@@ -304,7 +304,7 @@ describe('myzod', () => {
304304 { }
305305 ) ;
306306 const wantContains = [
307- 'export const UserCreateInputSchema: myzod.Type<UserCreateInput>' ,
307+ 'export function UserCreateInputSchema() : myzod.Type<UserCreateInput> { ' ,
308308 'profile: myzod.string().min(1, "Please input more than 1").max(5000, "Please input less than 5000").optional().nullable()' ,
309309 ] ;
310310 for ( const wantContain of wantContains ) {
@@ -334,7 +334,7 @@ describe('myzod', () => {
334334 { }
335335 ) ;
336336 const wantContains = [
337- 'export const UserCreateInputSchema: myzod.Type<UserCreateInput>' ,
337+ 'export function UserCreateInputSchema() : myzod.Type<UserCreateInput> { ' ,
338338 'profile: myzod.string().min(1, "Please input more than 1").max(5000, "Please input less than 5000")' ,
339339 ] ;
340340 for ( const wantContain of wantContains ) {
@@ -364,7 +364,7 @@ describe('myzod', () => {
364364 { }
365365 ) ;
366366 const wantContains = [
367- 'export const UserCreateInputSchema: myzod.Type<UserCreateInput>' ,
367+ 'export function UserCreateInputSchema() : myzod.Type<UserCreateInput> { ' ,
368368 'profile: myzod.array(myzod.string().nullable()).min(1, "Please input more than 1").max(5000, "Please input less than 5000").optional().nullable()' ,
369369 ] ;
370370 for ( const wantContain of wantContains ) {
0 commit comments