Commit 1631f6c5 by preetwinder

error message change and remove unused variable

1 parent 9dfafb7f
......@@ -34,12 +34,17 @@
this._sub_storage = jIO.createJIO(description.sub_storage);
this._database_name = "jio:" + description.database;
this._index_keys = description.index_keys || [];
this._version = 1;
}
IndexStorage2.prototype.hasCapacity = function (name) {
return ((name === "list") || (name === "query")) || (name === "limit") ||
(name === "select");
var this_storage_capacity_list = ["limit",
"select",
"list",
"query"];
if (this_storage_capacity_list.indexOf(name) !== -1) {
return true;
}
};
function checkArrayEquality(array1, array2) {
......@@ -221,10 +226,8 @@
try {
context._sub_storage.hasCapacity("query");
} catch (error) {
throw new jIO.util.jIOError(
"No index for this key and substorage doesn't support queries",
404
);
throw new jIO.util.jIOError("No index for '" + index +
"' key and substorage doesn't support queries", 404);
}
return context._sub_storage.buildQuery(
{ "query": index + ":" + value }
......
......@@ -132,6 +132,7 @@
ok(this.jio.hasCapacity("list"));
ok(this.jio.hasCapacity("query"));
ok(this.jio.hasCapacity("limit"));
ok(this.jio.hasCapacity("select"));
});
/////////////////////////////////////////////////////////////////
......@@ -194,7 +195,7 @@
}
});
stop();
expect(3);
expect(4);
DummyStorage3.prototype.put = function (id, value) {
equal(id, "32");
......@@ -207,7 +208,8 @@
return context.jio.allDocs({query: 'a: "3"'});
})
.then(function (result) {
deepEqual(result.data.rows[0], {"id": "32", "value": {}});
equal(result.data.total_rows, 1);
deepEqual(result.data.rows, [{"id": "32", "value": {}}]);
})
.fail(function (error) {
console.log(error);
......@@ -298,7 +300,7 @@
.fail(function (error) {
equal(error.status_code, 404);
equal(error.message,
"No index for this key and substorage doesn't support queries");
"No index for 'b' key and substorage doesn't support queries");
})
.always(function () {
start();
......@@ -731,7 +733,7 @@
});
});
test("Index keys modified", function () {
test("Index keys are modified", function () {
var context = this;
context.jio = jIO.createJIO({
type: "index2",
......@@ -805,7 +807,7 @@
.fail(function (error) {
equal(error.status_code, 404);
equal(error.message,
"No index for this key and substorage doesn't support queries");
"No index for 'a' key and substorage doesn't support queries");
})
.always(function () {
start();
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!