diff --git a/test/typings.ts b/test/typings.ts index ccbf0c3..9b5d35b 100644 --- a/test/typings.ts +++ b/test/typings.ts @@ -205,6 +205,36 @@ if (noRequiredFieldsValidator(input)) { if (typeof input.c !== 'undefined') assertType(input.c) } +const signupValidator = createValidator({ + type: 'object', + properties: { + email: { + type: 'string' + }, + paymentInformation: { + type: 'object', + properties: { + plan: { type: 'string' }, + token: { type: 'string' } + }, + required: [ + 'plan' as 'plan', + 'token' as 'token' + ] + } + }, + required: [ + 'paymentInformation' + ] +}) + +if (signupValidator(input)) { + if (typeof input.email !== 'string') assertType(input.email) + if (typeof input.email !== 'undefined') assertType(input.email) + assertType(input.paymentInformation.plan) + assertType(input.paymentInformation.token) +} + const animalValidator = createValidator({ oneOf: [ {