當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。