Commit 2f255abb authored by Romain Courteaud's avatar Romain Courteaud

idb: check capacity

parent 8ecb7533
......@@ -64,10 +64,7 @@
}
IndexedDBStorage.prototype.hasCapacity = function (name) {
if (name === "subquery") {
return this._index_keys;
}
return ((name === "list") || (name === "include")) || (name === "subquery");
return ((name === "list") || (name === "include"));
};
function buildKeyPath(key_list) {
......
......@@ -31,6 +31,7 @@
deepEqual = QUnit.deepEqual,
equal = QUnit.equal,
module = QUnit.module,
throws = QUnit.throws,
big_string = "",
j;
......@@ -244,12 +245,35 @@
/////////////////////////////////////////////////////////////////
module("indexeddbStorage.hasCapacity");
test("can list documents", function () {
expect(2);
var jio = jIO.createJIO({
type: "indexeddb",
database: "qunit"
});
ok(jio.hasCapacity("list"));
ok(jio.hasCapacity("include"));
});
test("can not search documents", function () {
expect(4);
var jio = jIO.createJIO({
type: "indexeddb",
database: "qunit"
});
throws(
function () {
jio.hasCapacity("query");
},
function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.status_code, 501);
equal(error.message,
"Capacity 'query' is not implemented on 'indexeddb'");
return true;
}
);
});
/////////////////////////////////////////////////////////////////
......
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