Commit fc1ab025 authored by Boris Kocherov's avatar Boris Kocherov

jslint fix

parent 78fce380
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
todo_tests; todo_tests;
QUnit.config.autostart = false; QUnit.config.autostart = false;
QUnit.dump.maxDepth = 10;
function replaceAll(str, searchStr, replaceStr) { function replaceAll(str, searchStr, replaceStr) {
searchStr = searchStr.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&'); searchStr = searchStr.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g, '\\$&');
...@@ -113,8 +114,10 @@ ...@@ -113,8 +114,10 @@
return gadget.getContent(); return gadget.getContent();
}) })
.push(function (json_document) { .push(function (json_document) {
assert.deepEqual(schema, schema_orig, "schema not change (side effect absent)"); assert.deepEqual(schema, schema_orig,
assert.deepEqual(JSON.parse(json_document[key]), value, "returned value equal"); "schema not change (side effect absent)");
assert.deepEqual(JSON.parse(json_document[key]), value,
"returned value equal");
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
assert.notOk(error, "issue in gadget"); assert.notOk(error, "issue in gadget");
...@@ -144,7 +147,8 @@ ...@@ -144,7 +147,8 @@
// XXX base URI change based on $id property not realised // XXX base URI change based on $id property not realised
todo_tests.push("base URI change: base URI change ref valid"); todo_tests.push("base URI change: base URI change ref valid");
todo_tests.push("base URI change - change folder: number is valid"); todo_tests.push("base URI change - change folder: number is valid");
todo_tests.push("base URI change - change folder in subschema: number is valid"); todo_tests.push("base URI change - change folder in subschema:" +
" number is valid");
function create_callback(schema, schema_url, value, valid) { function create_callback(schema, schema_url, value, valid) {
return function (assert) { return function (assert) {
...@@ -161,7 +165,7 @@ ...@@ -161,7 +165,7 @@
if (settings.invert_valid) { if (settings.invert_valid) {
valid = !valid; valid = !valid;
} }
create_gadget(function (method_name, argument_list) { create_gadget(function (method_name) {
if (method_name === "notifyValid") { if (method_name === "notifyValid") {
assert.ok(valid, "form correctly filled"); assert.ok(valid, "form correctly filled");
} else if (method_name === "notifyInvalid") { } else if (method_name === "notifyInvalid") {
...@@ -196,13 +200,16 @@ ...@@ -196,13 +200,16 @@
// if schema used check side error // if schema used check side error
// if schema_url used we can not check schema_side_error // if schema_url used we can not check schema_side_error
// because gadget himself download schema // because gadget himself download schema
assert.ok(json_document.hasOwnProperty(key), "getContent does not content property"); assert.ok(json_document.hasOwnProperty(key),
assert.deepEqual(schema, schema_orig, "schema changed (side effect on schema)"); "getContent does not content property");
assert.deepEqual(schema, schema_orig,
"schema changed (side effect on schema)");
} }
try { try {
returned_value = JSON.parse(json_document[key]); returned_value = JSON.parse(json_document[key]);
} catch (error) { } catch (error) {
assert.notOk("value not parsable:'" + returned_value + "'\n" + error); assert.notOk("value not parsable:'" +
returned_value + "'\n" + error);
} }
if (!changed) { if (!changed) {
assert.deepEqual(returned_value, value, assert.deepEqual(returned_value, value,
...@@ -254,11 +261,14 @@ ...@@ -254,11 +261,14 @@
m = list[i][k]; m = list[i][k];
skip_module = skip_modules.indexOf(m.description) >= 0; skip_module = skip_modules.indexOf(m.description) >= 0;
module(m.description); module(m.description);
schema = JSON.parse(replaceAll(JSON.stringify(m.schema), "http://localhost:1234/", schema = JSON.parse(replaceAll(JSON.stringify(m.schema),
"http://localhost:9000/node_modules/json-schema-test-suite/remotes/")); "http://localhost:1234/",
"http://localhost:9000/node_modules/" +
"json-schema-test-suite/remotes/"));
for (z = 0; z < m.tests.length; z += 1) { for (z = 0; z < m.tests.length; z += 1) {
t = m.tests[z]; t = m.tests[z];
if (todo_tests.indexOf(m.description + ': ' + t.description) >= 0) { if (todo_tests.indexOf(m.description + ': ' +
t.description) >= 0) {
create_test = QUnit.todo; create_test = QUnit.todo;
} else if (skip_module || skip_file) { } else if (skip_module || skip_file) {
create_test = QUnit.skip; create_test = QUnit.skip;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment