Commit 42a5a033 authored by Vincent Bechu's avatar Vincent Bechu Committed by Vincent Bechu

[querystorage] Fail on wrong schema

parent 7f71dd30
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
if (storage._key_schema.cast_lookup.dateType === undefined) { if (storage._key_schema.cast_lookup.dateType === undefined) {
storage._key_schema.cast_lookup.dateType = dateType; storage._key_schema.cast_lookup.dateType = dateType;
} }
} else {
throw new jIO.util.jIOError(
"Wrong schema for property: " + property,
400
);
} }
} }
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
// queryStorage.constructor // queryStorage.constructor
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
module("queryStorage.constructor"); module("queryStorage.constructor");
test("create substorage", function () { test("accept parameters", function () {
var jio = jIO.createJIO({ var jio = jIO.createJIO({
type: "query", type: "query",
schema: {'date': {type: 'string', format: 'date-time'}}, schema: {'date': {type: 'string', format: 'date-time'}},
...@@ -45,6 +45,27 @@ ...@@ -45,6 +45,27 @@
}); });
test("failed on wrond schema", function () {
throws(
function () {
jIO.createJIO({
type: "query",
schema: {'date': {type: 'couscous'}},
sub_storage: {
type: "querystorage200"
}
});
},
function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.status_code, 400);
equal(error.message,
"Wrong schema for property: date");
return true;
}
);
});
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// queryStorage.get // queryStorage.get
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
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