Commit bb373146 authored by Boris Kocherov's avatar Boris Kocherov

tests: use schema instead schema_url option when rendered

parent e9ac0240
......@@ -166,7 +166,7 @@
settings = test_settings[test_id] || {},
key = "foo_key",
schema_orig;
if (schema) {
if (schema !== undefined) {
schema_orig = JSON.parse(JSON.stringify(schema));
}
if (settings.invert_valid) {
......@@ -182,12 +182,17 @@
}
})
.push(function (g) {
gadget = g;
return gadget.render({
var opt = {
key: key,
schema_url: schema_url,
value: value
});
};
gadget = g;
if (schema !== undefined) {
opt.schema = schema;
} else {
opt.schema_url = schema_url;
}
return gadget.render(opt);
})
.push(function (element) {
assert.ok(element, "gadget rendered");
......@@ -195,7 +200,7 @@
})
.push(function (json_document) {
var returned_value;
if (schema_orig) {
if (schema_orig !== undefined) {
// if schema used check side error
// if schema_url used we can not check schema_side_error
// because gadget himself download schema
......@@ -248,7 +253,7 @@
z,
m,
t,
// schema,
schema,
skip_file,
skip_module,
create_test;
......@@ -258,8 +263,8 @@
m = list[i][k];
skip_module = skip_modules.indexOf(m.description) >= 0;
module(m.description);
// schema = JSON.parse(JSON.stringify(m.schema).replace("http://localhost:1234/",
// "http://localhost:9000/node_modules/json-schema-test-suite/remotes/"));
schema = JSON.parse(JSON.stringify(m.schema).replace("http://localhost:1234/",
"http://localhost:9000/node_modules/json-schema-test-suite/remotes/"));
for (z = 0; z < m.tests.length; z += 1) {
t = m.tests[z];
if (todo_tests.indexOf(m.description + ': ' + t.description) >= 0) {
......@@ -271,7 +276,7 @@
}
create_test(t.description, create_callback(
null, //schema
schema,
url_list[i] + '#/' + k + '/schema',
t.data,
t.valid
......
......@@ -65,17 +65,20 @@
k,
z,
m,
schema,
t;
for (i = 0; i < list.length; i += 1) {
for (k = 0; k < list[i].length; k += 1) {
m = list[i][k];
g.props.schemas.push(m.description);
g.props.documents[m.description] = [];
schema = JSON.parse(JSON.stringify(m.schema).replace("http://localhost:1234/",
"http://localhost:9000/node_modules/json-schema-test-suite/remotes/"));
for (z = 0; z < m.tests.length; z += 1) {
t = m.tests[z];
g.props.documents[m.description].push(t.description);
g.props.test_data[m.description + ': ' + t.description] = {
schema: m.schema,
schema: schema,
schema_url: url_list[i] + '#/' + k + '/schema',
data: t.data,
status: t.valid
......@@ -128,7 +131,7 @@
console.log(test.schema);
console.log(test.data);
return gadget.changeState({
schema_url: test.schema_url,
schema: test.schema,
json_document: test.data
});
}
......@@ -154,6 +157,7 @@
.push(function (form_view) {
return form_view.render({
value: g.state.json_document,
schema: g.state.schema,
schema_url: g.state.schema_url
})
.push(function () {
......
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