| 1 | import _Ajv from "../ajv" |
| 2 | import chai from "../chai" |
| 3 | chai.should() |
| 4 | |
| 5 | describe('issue #521, incorrect warning with "id" property', () => { |
| 6 | it("should not log warning", () => { |
| 7 | const ajv = new _Ajv() |
| 8 | const consoleWarn = console.warn |
| 9 | console.warn = () => { |
| 10 | throw new Error("should not log warning") |
| 11 | } |
| 12 | |
| 13 | try { |
| 14 | ajv.compile({ |
| 15 | $id: "http://example.com/schema.json", |
| 16 | type: "object", |
| 17 | properties: { |
| 18 | id: {type: "string"}, |
| 19 | }, |
| 20 | required: ["id"], |
| 21 | }) |
| 22 | } finally { |
| 23 | console.warn = consoleWarn |
| 24 | } |
| 25 | }) |
| 26 | }) |