@@ -6,7 +6,7 @@ import { plugin } from "../src/index";
6
6
describe ( "yup" , ( ) => {
7
7
test . each ( [
8
8
[
9
- "required " ,
9
+ "defined " ,
10
10
/* GraphQL */ `
11
11
input PrimitiveInput {
12
12
a: ID!
@@ -18,11 +18,11 @@ describe("yup", () => {
18
18
` ,
19
19
[
20
20
"export function PrimitiveInputSchema(): yup.SchemaOf<PrimitiveInput>" ,
21
- "a: yup.string().required ()" ,
22
- "b: yup.string().required ()" ,
23
- "c: yup.boolean().required ()" ,
24
- "d: yup.number().required ()" ,
25
- "e: yup.number().required ()" ,
21
+ "a: yup.string().defined ()" ,
22
+ "b: yup.string().defined ()" ,
23
+ "c: yup.boolean().defined ()" ,
24
+ "d: yup.number().defined ()" ,
25
+ "e: yup.number().defined ()" ,
26
26
] ,
27
27
] ,
28
28
[
@@ -34,7 +34,7 @@ describe("yup", () => {
34
34
c: Boolean
35
35
d: Int
36
36
e: Float
37
- z: String! # no required check
37
+ z: String! # no defined check
38
38
}
39
39
` ,
40
40
[
@@ -62,11 +62,11 @@ describe("yup", () => {
62
62
[
63
63
"export function ArrayInputSchema(): yup.SchemaOf<ArrayInput>" ,
64
64
"a: yup.array().of(yup.string()).optional()," ,
65
- "b: yup.array().of(yup.string().required ()).optional()," ,
66
- "c: yup.array().of(yup.string().required ()).required ()," ,
65
+ "b: yup.array().of(yup.string().defined ()).optional()," ,
66
+ "c: yup.array().of(yup.string().defined ()).defined ()," ,
67
67
"d: yup.array().of(yup.array().of(yup.string()).optional()).optional()," ,
68
- "e: yup.array().of(yup.array().of(yup.string()).required ()).optional()," ,
69
- "f: yup.array().of(yup.array().of(yup.string()).required ()).required ()" ,
68
+ "e: yup.array().of(yup.array().of(yup.string()).defined ()).optional()," ,
69
+ "f: yup.array().of(yup.array().of(yup.string()).defined ()).defined ()" ,
70
70
] ,
71
71
] ,
72
72
[
@@ -84,11 +84,11 @@ describe("yup", () => {
84
84
` ,
85
85
[
86
86
"export function AInputSchema(): yup.SchemaOf<AInput>" ,
87
- "b: yup.lazy(() => BInputSchema().required ()) as never" ,
87
+ "b: yup.lazy(() => BInputSchema().defined ()) as never" ,
88
88
"export function BInputSchema(): yup.SchemaOf<BInput>" ,
89
- "c: yup.lazy(() => CInputSchema().required ()) as never" ,
89
+ "c: yup.lazy(() => CInputSchema().defined ()) as never" ,
90
90
"export function CInputSchema(): yup.SchemaOf<CInput>" ,
91
- "a: yup.lazy(() => AInputSchema().required ()) as never" ,
91
+ "a: yup.lazy(() => AInputSchema().defined ()) as never" ,
92
92
] ,
93
93
] ,
94
94
[
@@ -119,7 +119,7 @@ describe("yup", () => {
119
119
[
120
120
"export const PageTypeSchema = yup.mixed().oneOf([PageType.Public, PageType.BasicAuth])" ,
121
121
"export function PageInputSchema(): yup.SchemaOf<PageInput>" ,
122
- "pageType: PageTypeSchema.required ()" ,
122
+ "pageType: PageTypeSchema.defined ()" ,
123
123
] ,
124
124
] ,
125
125
[
@@ -141,7 +141,7 @@ describe("yup", () => {
141
141
"export function HttpInputSchema(): yup.SchemaOf<HttpInput>" ,
142
142
"export const HttpMethodSchema = yup.mixed().oneOf([HttpMethod.Get, HttpMethod.Post])" ,
143
143
"method: HttpMethodSchema" ,
144
- "url: yup.mixed().required ()" ,
144
+ "url: yup.mixed().defined ()" ,
145
145
] ,
146
146
] ,
147
147
] ) ( "%s" , async ( _ , textSchema , wantContains ) => {
@@ -175,8 +175,8 @@ describe("yup", () => {
175
175
} ,
176
176
{ }
177
177
) ;
178
- expect ( result . content ) . toContain ( "phrase: yup.string().required ()" ) ;
179
- expect ( result . content ) . toContain ( "times: yup.number().required ()" ) ;
178
+ expect ( result . content ) . toContain ( "phrase: yup.string().defined ()" ) ;
179
+ expect ( result . content ) . toContain ( "times: yup.number().defined ()" ) ;
180
180
} ) ;
181
181
182
182
it ( "with importFrom" , async ( ) => {
@@ -194,7 +194,7 @@ describe("yup", () => {
194
194
{ }
195
195
) ;
196
196
expect ( result . prepend ) . toContain ( "import { Say } from './types'" ) ;
197
- expect ( result . content ) . toContain ( "phrase: yup.string().required ()" ) ;
197
+ expect ( result . content ) . toContain ( "phrase: yup.string().defined ()" ) ;
198
198
} ) ;
199
199
200
200
it ( "with enumsAsTypes" , async ( ) => {
0 commit comments