本文整理汇总了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)
})