Commit 4f8d9ed2 authored by preetwinder's avatar preetwinder

Migration handling and improved querying support

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