Commit 4f8d9ed2 authored by preetwinder's avatar preetwinder

Migration handling and improved querying support

parent cd07ec24
This diff is collapsed.
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
var gadget = this; var gadget = this;
return gadget._sub_storage.post(value) return gadget._sub_storage.post(value)
.push(function (id) { .push(function (id) {
return gadget._signature_storage.put(id, {"id": id}) return gadget._signature_storage.put(id, {})
.push(function () { .push(function () {
return id; return id;
}); });
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
var gadget = this; var gadget = this;
return gadget._sub_storage.put(id, value) return gadget._sub_storage.put(id, value)
.push(function (result) { .push(function (result) {
return gadget._signature_storage.put(id, {"id": id}) return gadget._signature_storage.put(id, {})
.push(function () { .push(function () {
return result; return result;
}); });
...@@ -78,11 +78,12 @@ ...@@ -78,11 +78,12 @@
}; };
ListStorage.prototype.hasCapacity = function (name) { ListStorage.prototype.hasCapacity = function (name) {
if (name === "list") { if (name === "list") {
return true; return this._signature_storage.hasCapacity('list');
} }
return false;
}; };
ListStorage.prototype.buildQuery = function () { ListStorage.prototype.buildQuery = function () {
return this._signature_storage.buildQuery({}); return this._signature_storage.buildQuery();
}; };
jIO.addStorage('list', ListStorage); jIO.addStorage('list', ListStorage);
......
This diff is collapsed.
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
}; };
DummyStorage2.prototype.put = function (id, value) { DummyStorage2.prototype.put = function (id, value) {
equal(id, 'posted'); equal(id, 'posted');
deepEqual(value, {'id': 'posted'}); deepEqual(value, {});
return id; return id;
}; };
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
}; };
DummyStorage2.prototype.put = function (id, param) { DummyStorage2.prototype.put = function (id, param) {
equal(id, "1"); equal(id, "1");
deepEqual(param, {'id': '1'}); deepEqual(param, {});
return id; return id;
}; };
...@@ -372,6 +372,7 @@ ...@@ -372,6 +372,7 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
module("ListStorage.hasCapacity"); module("ListStorage.hasCapacity");
test("list capacity is implemented", function () { test("list capacity is implemented", function () {
expect(2);
var jio = jIO.createJIO({ var jio = jIO.createJIO({
type: "list", type: "list",
...@@ -386,6 +387,10 @@ ...@@ -386,6 +387,10 @@
DummyStorage1.prototype.hasCapacity = function () { DummyStorage1.prototype.hasCapacity = function () {
return false; return false;
}; };
DummyStorage2.prototype.hasCapacity = function (capacity) {
equal(capacity, 'list');
return true;
};
ok(jio.hasCapacity("list")); ok(jio.hasCapacity("list"));
}); });
...@@ -396,7 +401,7 @@ ...@@ -396,7 +401,7 @@
module("ListStorage.buildQuery"); module("ListStorage.buildQuery");
test("buildQuery calls substorage buildQuery", function () { test("buildQuery calls substorage buildQuery", function () {
stop(); stop();
expect(2); expect(1);
var jio = jIO.createJIO({ var jio = jIO.createJIO({
type: "list", type: "list",
...@@ -408,12 +413,11 @@ ...@@ -408,12 +413,11 @@
} }
}); });
DummyStorage2.prototype.buildQuery = function (params) { DummyStorage2.prototype.buildQuery = function () {
deepEqual(params, {});
return [{"id": "1"}, {"id": "2"}]; return [{"id": "1"}, {"id": "2"}];
}; };
jio.buildQuery({}) jio.buildQuery()
.then(function (result) { .then(function (result) {
deepEqual(result, [{"id": "1"}, {"id": "2"}]); deepEqual(result, [{"id": "1"}, {"id": "2"}]);
}) })
......
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