Commit adb69072 authored by Bryan Kaperick's avatar Bryan Kaperick

Tests are not passing, but no longer having error with options passed to...

Tests are not passing, but no longer having error with options passed to QueryStorage.buildQuery as undefined.
parent d7ecff55
...@@ -158,12 +158,15 @@ ...@@ -158,12 +158,15 @@
//return this._sub_storage.buildQuery.apply(this._sub_storage, options); //return this._sub_storage.buildQuery.apply(this._sub_storage, options);
}; };
**/ **/
BryanStorage.prototype.buildQuery = function (options) { BryanStorage.prototype.buildQuery = function () {
/**
if (options === undefined) { if (options === undefined) {
options = {}; options = {};
} }
console.log("options", options); options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
return this._sub_storage.buildQuery.apply(this._sub_storage, options); **/
console.log("options", arguments);
return this._sub_storage.buildQuery.apply(this._sub_storage, arguments);
}; };
jIO.addStorage('bryan', BryanStorage); jIO.addStorage('bryan', BryanStorage);
......
...@@ -11,11 +11,10 @@ ...@@ -11,11 +11,10 @@
equal = QUnit.equal, equal = QUnit.equal,
module = QUnit.module; module = QUnit.module;
/**
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// _revision parameter updating with RSVP all // _revision parameter updating with RSVP all
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
/**
module("bryanStorage _revision with RSVP all"); module("bryanStorage _revision with RSVP all");
test("verifying _revision updates correctly when puts are done in parallel", test("verifying _revision updates correctly when puts are done in parallel",
function () { function () {
...@@ -34,11 +33,13 @@ ...@@ -34,11 +33,13 @@
}); });
jio.put("bar", {"title": "foo"}); jio.put("bar", {"title": "foo"});
RSVP.all( RSVP.all([
jio.put("bar", {"title2": "foo2"}), jio.put("bar", {"title2": "foo2"}),
jio.put("bar", {"title3": "foo3"}) jio.put("bar", {"title3": "foo3"})
) ]
.push(function () {return jio.get("bar"); }) );
//.push(function () {return jio.get("bar"); })
jio.get("bar")
.push(function (result) {equal(result._revision, 3, "parallel exec"); }) .push(function (result) {equal(result._revision, 3, "parallel exec"); })
.fail(function (error) {ok(false, error); }) .fail(function (error) {ok(false, error); })
.always(function () {start(); }); .always(function () {start(); });
...@@ -53,18 +54,18 @@ ...@@ -53,18 +54,18 @@
test("put and get the correct version", function () { test("put and get the correct version", function () {
stop(); stop();
expect(4); expect(4);
var dbname = "testingdb4", var dbname = "freshdb0",
jio = jIO.createJIO({ jio = jIO.createJIO({
type: "bryan", type: "bryan",
sub_storage: { sub_storage: {
type: "uuid", type: "uuid",
sub_storage: { sub_storage: {
type: "memory" //type: "memory"
//type: "indexeddb", type: "indexeddb",
//database: dbname database: dbname
} }
} }
});/**, }),
not_bryan = jIO.createJIO({ not_bryan = jIO.createJIO({
type: "uuid", type: "uuid",
sub_storage: { sub_storage: {
...@@ -76,12 +77,12 @@ ...@@ -76,12 +77,12 @@
} }
} }
}); });
**/
jio.put("doc1", { jio.put("doc1", {
"title": "rev0", "title": "rev0",
"subtitle": "subrev0" "subtitle": "subrev0"
}) })
/**
.push(function () {return jio.get("doc1"); }) .push(function () {return jio.get("doc1"); })
.push(function (result) { .push(function (result) {
deepEqual(result, { deepEqual(result, {
...@@ -110,17 +111,10 @@ ...@@ -110,17 +111,10 @@
"subtitle": "subrev2" "subtitle": "subrev2"
}, "Retrieve second edition of document correctly"); }, "Retrieve second edition of document correctly");
}) })
**/
.push(function () { .push(function () {
var options = { var options = {query: "title: rev0"};
query: "title: rev0"
};
//
//
//return jio.buildQuery(options);
return jio.allDocs(options); return jio.allDocs(options);
//
//
}) })
.push(function (results) { .push(function (results) {
console.log("query results: ", results); console.log("query results: ", results);
...@@ -135,7 +129,7 @@ ...@@ -135,7 +129,7 @@
"subtitle": "subrev2" "subtitle": "subrev2"
}, "Retrieve queried document correctly"); }, "Retrieve queried document correctly");
}) })
/**
// When not_bryan queries the storage, all documents are returned. // When not_bryan queries the storage, all documents are returned.
.push(function () { .push(function () {
var options = { var options = {
...@@ -160,7 +154,7 @@ ...@@ -160,7 +154,7 @@
}, },
"Get the earliest copy of the doc with all metadata."); "Get the earliest copy of the doc with all metadata.");
}) })
**/
.fail(function (error) { .fail(function (error) {
console.log(error); console.log(error);
ok(false, error); ok(false, error);
......
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