本文整理匯總了TypeScript中test/app/forms/models/validationUtils.expectValidationError函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript expectValidationError函數的具體用法?TypeScript expectValidationError怎麽用?TypeScript expectValidationError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了expectValidationError函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should reject custom InterestStartDate date without date and reason', () => {
const errors = validator.validateSync(new InterestStartDate(undefined, undefined))
expect(errors.length).to.equal(2)
expectValidationError(errors, CommonValidationErrors.DATE_REQUIRED)
expectValidationError(errors, ValidationErrors.REASON_REQUIRED)
})
示例2: it
it('when both args are empty strings', () => {
const errors = validator.validateSync(new EmployerRow('', ''))
expect(errors.length).to.equal(2)
expectValidationError(errors, ValidationErrors.EMPLOYER_NAME_REQUIRED)
expectValidationError(errors, ValidationErrors.JOB_TITLE_REQUIRED)
})
示例3: it
it('should return errors when `IncomeSource` objects are invalid', () => {
const errors = validator.validateSync(
new MonthlyIncome(
undefined, new IncomeSource(MonthlyIncomeType.JOB.displayValue, -100, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.UNIVERSAL_CREDIT.displayValue, -200, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.JOB_SEEKERS_ALLOWANCE_INCOME_BASES.displayValue, -300, IncomeExpenseSchedule.TWO_WEEKS),
undefined, new IncomeSource(MonthlyIncomeType.JOB_SEEKERS_ALLOWANCE_CONTRIBUTION_BASED.displayValue, -400, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.INCOME_SUPPORT.displayValue, -500, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.WORKING_TAX_CREDIT.displayValue, -600, IncomeExpenseSchedule.TWO_WEEKS),
undefined, new IncomeSource(MonthlyIncomeType.CHILD_TAX_CREDIT.displayValue, -700, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.CHILD_BENEFIT.displayValue, -800, IncomeExpenseSchedule.MONTH),
undefined, new IncomeSource(MonthlyIncomeType.COUNCIL_TAX_SUPPORT.displayValue, -900, IncomeExpenseSchedule.TWO_WEEKS),
undefined, new IncomeSource(MonthlyIncomeType.PENSION.displayValue, -100, IncomeExpenseSchedule.TWO_WEEKS)
)
)
expect(errors.length).to.equal(10)
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.JOB.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.UNIVERSAL_CREDIT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.JOB_SEEKERS_ALLOWANCE_INCOME_BASES.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.JOB_SEEKERS_ALLOWANCE_CONTRIBUTION_BASED.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.INCOME_SUPPORT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.WORKING_TAX_CREDIT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.CHILD_TAX_CREDIT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.CHILD_BENEFIT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.COUNCIL_TAX_SUPPORT.displayValue))
expectValidationError(errors, MonthlyIncomeSourceValidationErrors.AMOUNT_NON_NEGATIVE_NUMBER_REQUIRED(MonthlyIncomeType.PENSION.displayValue))
})
示例4: it
it('when both args are empty strings', () => {
const errors = validator.validateSync(new TimelineRow('', ''))
expect(errors.length).to.equal(2)
expectValidationError(errors, GlobalValidationErrors.DATE_REQUIRED)
expectValidationError(errors, ValidationErrors.DESCRIPTION_REQUIRED)
})
示例5: it
it('should reject custom InterestRate without rate and reason', () => {
const errors = validator.validateSync(new InterestRate(InterestRateOption.DIFFERENT, undefined, undefined))
expect(errors.length).to.equal(2)
expectValidationError(errors, ValidationErrors.RATE_REQUIRED)
expectValidationError(errors, ValidationErrors.REASON_REQUIRED)
})
示例6: it
it('undefined option', () => {
const errors = validator.validateSync(new PaymentPlan(undefined))
expect(errors.length).to.equal(3)
expectValidationError(errors, CommonValidationErrors.AMOUNT_INVALID_LESS_THAN_ONE_POUND)
expectValidationError(errors, ValidationErrors.SCHEDULE_REQUIRED)
expectValidationError(errors, ValidationErrors.FIRST_PAYMENT_DATE_INVALID)
})
示例7: it
it('should reject InterestTotal with undefined type', () => {
const errors = validator.validateSync(new InterestTotal(undefined))
expect(errors.length).to.equal(2)
expectValidationError(errors, CommonValidationErrors.AMOUNT_REQUIRED)
expectValidationError(errors, ValidationErrors.REASON_REQUIRED)
})
示例8: it
it('should reject date with values greater then upper limit', () => {
const errors = validator.validateSync(new LocalDate(10000, 13, 32))
expect(errors.length).to.equal(3)
expectValidationError(errors, ValidationErrors.YEAR_NOT_VALID)
expectValidationError(errors, ValidationErrors.MONTH_NOT_VALID)
expectValidationError(errors, ValidationErrors.DAY_NOT_VALID)
})