Commit 6e54a1e3 authored by Nicolas Wavrant's avatar Nicolas Wavrant

querystorage.js: hasCapacity shouldn't return True by default

parent ac34b9ef
......@@ -44,10 +44,19 @@
};
QueryStorage.prototype.hasCapacity = function (name) {
var this_storage_capacity_list = ["limit",
"include",
"sort",
"select",
"query"];
if (this_storage_capacity_list.indexOf(name) !== -1) {
return true;
}
if (name === "list") {
return this._sub_storage.hasCapacity(name);
}
return true;
return false;
};
QueryStorage.prototype.buildQuery = function (options) {
var substorage = this._sub_storage,
......
......@@ -307,7 +307,7 @@
// queryStorage.hasCapacity
/////////////////////////////////////////////////////////////////
module("queryStorage.hasCapacity");
test("hasCapacity is true by default", function () {
test("hasCapacity is false by default", function () {
var jio = jIO.createJIO({
type: "query",
sub_storage: {
......@@ -315,7 +315,18 @@
}
});
equal(jio.hasCapacity("foo"), true);
throws(
function () {
jio.hasCapacity("foo");
},
function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.status_code, 501);
equal(error.message,
"Capacity 'foo' is not implemented on 'query'");
return true;
}
);
});
test("hasCapacity list return substorage value", 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