Exemplo n.º 1
0
 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)
 })
Exemplo n.º 2
0
    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)
    })
Exemplo n.º 3
0
      it('when both are valid strings', () => {
        const errors = validator.validateSync(new EvidenceRow(EvidenceType.OTHER, 'description'))

        expect(errors.length).to.equal(0)
      })
    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)
    })
Exemplo n.º 5
0
      it('invalid option', () => {
        const errors = validator.validateSync(new PaymentOption(new PaymentType('unknown')))

        expect(errors.length).to.equal(1)
        expectValidationError(errors, ValidationErrors.OPTION_REQUIRED)
      })
Exemplo n.º 6
0
        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)
        })
Exemplo n.º 7
0
        it('should reject date with invalid digits in year', () => {
          const errors = validator.validateSync(new PaymentDate(new LocalDate(90, 12, 31)))

          expect(errors.length).to.equal(1)
          expectValidationError(errors, LocalDateValidationErrors.YEAR_FORMAT_NOT_VALID)
        })
 it('should return error when address is undefined', () => {
   individualDetails.address = undefined
   let errors: ValidationError[] = validator.validateSync(individualDetails)
   expectValidationError(errors, PartyDetailsValidationErrors.ADDRESS_REQUIRED)
 })
 it('should return errors when required address fields are missing', () => {
   let errors: ValidationError[] = validator.validateSync(individualDetails)
   expectValidationError(errors, AddressValidationErrors.FIRST_LINE_REQUIRED)
   expectValidationError(errors, AddressValidationErrors.POSTCODE_REQUIRED)
 })
Exemplo n.º 10
0
 it('should return error when correspondence address is undefined', () => {
   individualDetails.correspondenceAddress = undefined
   let errors: ValidationError[] = validator.validateSync(individualDetails)
   expectValidationError(errors, PartyDetailsValidationErrors.CORRESPONDENCE_ADDRESS_REQUIRED)
 })