@@ -6,7 +6,7 @@ import { plugin } from "../src/index";
66describe ( "yup" , ( ) => {
77 test . each ( [
88 [
9- "required " ,
9+ "defined " ,
1010 /* GraphQL */ `
1111 input PrimitiveInput {
1212 a: ID!
@@ -18,11 +18,11 @@ describe("yup", () => {
1818 ` ,
1919 [
2020 "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 ()" ,
2626 ] ,
2727 ] ,
2828 [
@@ -34,7 +34,7 @@ describe("yup", () => {
3434 c: Boolean
3535 d: Int
3636 e: Float
37- z: String! # no required check
37+ z: String! # no defined check
3838 }
3939 ` ,
4040 [
@@ -62,11 +62,11 @@ describe("yup", () => {
6262 [
6363 "export function ArrayInputSchema(): yup.SchemaOf<ArrayInput>" ,
6464 "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 ()," ,
6767 "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 ()" ,
7070 ] ,
7171 ] ,
7272 [
@@ -84,11 +84,11 @@ describe("yup", () => {
8484 ` ,
8585 [
8686 "export function AInputSchema(): yup.SchemaOf<AInput>" ,
87- "b: yup.lazy(() => BInputSchema().required ()) as never" ,
87+ "b: yup.lazy(() => BInputSchema().defined ()) as never" ,
8888 "export function BInputSchema(): yup.SchemaOf<BInput>" ,
89- "c: yup.lazy(() => CInputSchema().required ()) as never" ,
89+ "c: yup.lazy(() => CInputSchema().defined ()) as never" ,
9090 "export function CInputSchema(): yup.SchemaOf<CInput>" ,
91- "a: yup.lazy(() => AInputSchema().required ()) as never" ,
91+ "a: yup.lazy(() => AInputSchema().defined ()) as never" ,
9292 ] ,
9393 ] ,
9494 [
@@ -119,7 +119,7 @@ describe("yup", () => {
119119 [
120120 "export const PageTypeSchema = yup.mixed().oneOf([PageType.Public, PageType.BasicAuth])" ,
121121 "export function PageInputSchema(): yup.SchemaOf<PageInput>" ,
122- "pageType: PageTypeSchema.required ()" ,
122+ "pageType: PageTypeSchema.defined ()" ,
123123 ] ,
124124 ] ,
125125 [
@@ -141,7 +141,7 @@ describe("yup", () => {
141141 "export function HttpInputSchema(): yup.SchemaOf<HttpInput>" ,
142142 "export const HttpMethodSchema = yup.mixed().oneOf([HttpMethod.Get, HttpMethod.Post])" ,
143143 "method: HttpMethodSchema" ,
144- "url: yup.mixed().required ()" ,
144+ "url: yup.mixed().defined ()" ,
145145 ] ,
146146 ] ,
147147 ] ) ( "%s" , async ( _ , textSchema , wantContains ) => {
@@ -175,8 +175,8 @@ describe("yup", () => {
175175 } ,
176176 { }
177177 ) ;
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 ()" ) ;
180180 } ) ;
181181
182182 it ( "with importFrom" , async ( ) => {
@@ -194,7 +194,7 @@ describe("yup", () => {
194194 { }
195195 ) ;
196196 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 ()" ) ;
198198 } ) ;
199199
200200 it ( "with enumsAsTypes" , async ( ) => {
0 commit comments