Commit 9bb5cdfc authored by Hardik Juneja's avatar Hardik Juneja

Improve performance and make build query use new functions

parent 2ca6c591
This diff is collapsed.
......@@ -428,7 +428,7 @@
});
});
test("get with property and its value mapped using regex", function () {
test("get with property ad value mapped using regex and switch", function () {
stop();
expect(2);
......@@ -439,10 +439,16 @@
},
mapping_dict: {
"title": {
"equal": "someTitle",
"value": {
"otherFoo": {
"regex": "foo.*|bar.*",
"default_value": "otherFoo"
"switch": {
"foo": {
"regex": "other.*",
"default_value": "otherFoo"
},
"bar": {
"equal": "otherBar"
}
}
}
}
......@@ -451,13 +457,13 @@
Storage2713.prototype.get = function (id) {
equal(id, "42", "get 2713 called");
return {"title": "otherFoo", "smth": "bar"};
return {"someTitle": "otherFoo", "smth": "bar"};
};
jio.get("42")
.push(function (result) {
deepEqual(result, {
"title": "otherFoo",
"title": "foo",
"smth": "bar"
});
}).push(undefined, function (error) {
......@@ -832,9 +838,55 @@
"title": {
"equal": "someTitle",
"value": {
"otherFoo": {
"foo": {
"regex": "foo.*|bar.*",
"use": "otherFoo"
"default_value": "otherFoo"
}
}
}
}
});
Storage2713.prototype.put = function (id, doc) {
deepEqual(doc,
{"someTitle": "otherFoo", "smth": "bar"}, "post 2713 called");
equal(id, "42", "put 2713 called");
return id;
};
jio.put("42", {"title": "foo", "smth": "bar"})
.push(function (result) {
equal(result, "42");
})
.push(undefined, function (error) {
ok(false, error);
})
.always(function () {
start();
});
});
test("put with property, value mapped using regex and switch", function () {
stop();
expect(3);
var jio = jIO.createJIO({
type: "mapping",
sub_storage: {
type: "mappingstorage2713"
},
mapping_dict: {
"title": {
"equal": "someTitle",
"value": {
"switch": {
"foo": {
"regex": "other.*",
"default_value": "otherFoo"
},
"bar": {
"equal": "otherBar"
}
}
}
}
......@@ -848,7 +900,7 @@
return id;
};
jio.put("42", {"title": "foo1", "smth": "bar"})
jio.put("42", {"title": "foo", "smth": "bar"})
.push(function (result) {
equal(result, "42");
})
......@@ -1732,11 +1784,9 @@
deepEqual(
result,
[{
"id": "foo",
"title": "bar",
"bar": "foo"
}, {
"id": "bar",
"title": "foo",
"foo": "bar"
}],
......
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