(definition, numErrors?: number)
| 979 | } |
| 980 | |
| 981 | function testMultipleRangeKeyword(definition, numErrors?: number) { |
| 982 | instances.forEach((_ajv) => { |
| 983 | _ajv.opts.strictTypes = false |
| 984 | _ajv.addKeyword(definition) |
| 985 | _ajv.addKeyword({keyword: "exclusiveRange", schemaType: "boolean"}) |
| 986 | |
| 987 | const schema = { |
| 988 | properties: { |
| 989 | a: {type: "number", "x-range": [2, 4], exclusiveRange: true}, |
| 990 | b: {type: "number", "x-range": [2, 4], exclusiveRange: false}, |
| 991 | }, |
| 992 | additionalProperties: {type: "number", "x-range": [5, 7]}, |
| 993 | items: {type: "number", "x-range": [5, 7]}, |
| 994 | } |
| 995 | const validate = _ajv.compile(schema) |
| 996 | |
| 997 | shouldBeValid(validate, {a: 3.99, b: 4}) |
| 998 | shouldBeInvalid(validate, {a: 4, b: 4}, numErrors) |
| 999 | |
| 1000 | shouldBeValid(validate, {a: 2.01, c: 7}) |
| 1001 | shouldBeInvalid(validate, {a: 2.01, c: 7.01}, numErrors) |
| 1002 | |
| 1003 | shouldBeValid(validate, [5, 6, 7]) |
| 1004 | shouldBeInvalid(validate, [7.01], numErrors) |
| 1005 | }) |
| 1006 | } |
| 1007 | |
| 1008 | function shouldBeRangeError( |
| 1009 | error, |
no test coverage detected
searching dependent graphs…