Debian Codegraph @

test/tests/00 - Core/03 - resetAndDrop.js

raw symbols SCIP
1 describe("Core 03", function () {
2
3 it("tv4.dropSchemas() drops stored schemas", function () {
4 var schema = {
5 "items": {"$ref": "http://example.com/schema/items#"},
6 "maxItems": 2
7 };
8 tv4.addSchema("http://example.com/schema", schema);
9 assert.strictEqual(tv4.getSchema("http://example.com/schema"), schema, "has schema");
10
11 tv4.dropSchemas();
12 assert.isUndefined(tv4.getSchema("http://example.com/schema"), "doesn't have schema");
13 });
14
15 it("tv4.reset() clears errors, valid and missing", function () {
16 it("must be string, is integer", function () {
17 var data = 5;
18 var schema = {"type": "array", "items" : {"$ref" : "http://example.com"}};
19
20 assert.notOk(tv4.error, "starts with no error");
21 assert.isTrue(tv4.valid, "starts valid");
22 assert.length(tv4.missing, 0, "starts with 0 missing");
23
24 var valid = tv4.validate(data, schema);
25 assert.isFalse(valid);
26 assert.ok(tv4.error, "has error");
27 assert.isFalse(tv4.valid, "is invalid");
28 assert.length(tv4.missing, 1, "missing 1");
29
30 tv4.reset();
31 assert.notOk(tv4.error, "reset to no error");
32 assert.isTrue(tv4.valid, "reset to valid");
33 assert.length(tv4.missing, 0, "reset to 0 missing");
34 });
35 });
36 });