本文整理匯總了TypeScript中@hmcts/class-validator.Validator.validateSync方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Validator.validateSync方法的具體用法?TypeScript Validator.validateSync怎麽用?TypeScript Validator.validateSync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@hmcts/class-validator.Validator
的用法示例。
在下文中一共展示了Validator.validateSync方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should return errors when correspondence address fields have too long values', () => {
let errors: ValidationError[] = validator.validateSync(partyDetails)
expectValidationError(errors, CorrespondenceAddressValidationErrors.FIRST_LINE_REQUIRED)
expectValidationError(errors, CorrespondenceAddressValidationErrors.CITY_REQUIRED)
expectValidationError(errors, CorrespondenceAddressValidationErrors.POSTCODE_REQUIRED)
})
示例2: it
it('should reject InterestEndDate with unrecognised type', () => {
const errors = validator.validateSync(new InterestEndDate('unrecognised-type'))
expect(errors.length).to.equal(1)
expectValidationError(errors, ValidationErrors.INTEREST_END_DATE_REQUIRED)
})
示例3: it
it('when both are valid strings', () => {
const errors = validator.validateSync(new EvidenceRow(EvidenceType.OTHER, 'description'))
expect(errors.length).to.equal(0)
})
示例4: it
it('Should reject an invalid option', () => {
const errors = validator.validateSync(new PartPaymentReceived(YesNoOption.fromObject('invalid option')))
expect(errors).to.be.length(1)
expectValidationError(errors, ValidationErrors.YES_NO_REQUIRED)
})
示例5: it
it('invalid option', () => {
const errors = validator.validateSync(new PaymentOption(new PaymentType('unknown')))
expect(errors.length).to.equal(1)
expectValidationError(errors, ValidationErrors.OPTION_REQUIRED)
})
示例6: it
it('when date in the past', () => {
const errors = validator.validateSync(new PaymentDate(new LocalDate().deserialize(validDateInThePastObj.date)))
expect(errors.length).to.equal(1)
expectValidationError(errors, ValidationErrors.DATE_TODAY_OR_IN_FUTURE)
})
示例7: it
it('should return error when address is undefined', () => {
individualDetails.address = undefined
let errors: ValidationError[] = validator.validateSync(individualDetails)
expectValidationError(errors, PartyDetailsValidationErrors.ADDRESS_REQUIRED)
})