-
-
Notifications
You must be signed in to change notification settings - Fork 877
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62048a1
commit 2a407d7
Showing
2 changed files
with
23 additions
and
5 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,19 @@ | ||
import _Ajv from "../ajv2020" | ||
import * as assert from "assert" | ||
|
||
describe("`minContains: 0` without valid items (issue #1819)", () => { | ||
const ajv = new _Ajv() | ||
|
||
const schema = { | ||
"type": "array", | ||
"minContains": 0, | ||
"maxContains": 1, | ||
"contains": {"type": "number"} | ||
} | ||
|
||
const validate = ajv.compile(schema) | ||
|
||
it("no items valid", () => assert.strictEqual(validate(["foo"]), true)) | ||
it("1 item valid", () => assert.strictEqual(validate(["foo", 1]), true)) | ||
it("2 items invalid", () => assert.strictEqual(validate(["foo", 1, 2]), false)) | ||
}) |