-
-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix incorrect code for additional properties when there are "many" pr…
…operties, closes #1501
- Loading branch information
1 parent
2ada8d6
commit 3ae14a3
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type Ajv from "../.." | ||
import _Ajv from "../ajv_jtd" | ||
import * as assert from "assert" | ||
|
||
const PROP_COUNT = 10 | ||
|
||
describe("schema with many properties", () => { | ||
let ajv: Ajv | ||
const schema = {properties: {}} | ||
const data = {} | ||
const invalidData = {} | ||
|
||
before(() => { | ||
ajv = new _Ajv() | ||
for (let i = 0; i < PROP_COUNT; i++) { | ||
const prop = `prop${i}` | ||
schema.properties[prop] = {type: "uint16"} | ||
data[prop] = i | ||
invalidData[prop] = -i | ||
} | ||
}) | ||
|
||
it("should correctly compile reference to schema", () => { | ||
assert.strictEqual(ajv.validate(schema, data), true) | ||
assert.strictEqual(ajv.validate(schema, invalidData), false) | ||
}) | ||
}) |