当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Validator.validateSync方法代码示例

本文整理汇总了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)
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:partyDetails.ts

示例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)
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:interestEndDate.ts

示例3: it

      it('when both are valid strings', () => {
        const errors = validator.validateSync(new EvidenceRow(EvidenceType.OTHER, 'description'))

        expect(errors.length).to.equal(0)
      })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:evidenceRow.ts

示例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)
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:partPaymentAccepted.ts

示例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)
      })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:paymentOption.ts

示例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)
        })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:paymentDate.ts

示例7: it

 it('should return error when address is undefined', () => {
   individualDetails.address = undefined
   let errors: ValidationError[] = validator.validateSync(individualDetails)
   expectValidationError(errors, PartyDetailsValidationErrors.ADDRESS_REQUIRED)
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:individualDetails.ts


注:本文中的@hmcts/class-validator.Validator.validateSync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。