From 47be6a0c3007f139999bb0009e46cbd1be9e3d3f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Jun 2017 15:41:00 +0200 Subject: Tolerate more than one validation error in tests --- test/schema_test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/schema_test.ts b/test/schema_test.ts index e40ad1871..a608e867d 100644 --- a/test/schema_test.ts +++ b/test/schema_test.ts @@ -16,7 +16,11 @@ describe('Schema', () => { const validator = new SchemaValidator(); const validateAgainstSchema = (testCases: any[], schema: any, shouldFail = false) => { _.forEach(testCases, (testCase: any) => { - expect(validator.validate(testCase, schema).errors).to.be.lengthOf(shouldFail ? 1 : 0); + if (shouldFail) { + expect(validator.validate(testCase, schema).errors).to.be.lengthOf.at.least(1); + } else { + expect(validator.validate(testCase, schema).errors).to.be.lengthOf(0); + } }); }; describe('#numberSchema', () => { -- cgit v1.2.3