Commit 84145701 authored by Tristan Cavelier's avatar Tristan Cavelier

localstorage.tests.js + jio/tests.js jslint pass

parent d1dbaade
...@@ -349,7 +349,9 @@ ...@@ -349,7 +349,9 @@
} }
}); });
util.jsonlocalstorage.setItem( util.jsonlocalstorage.setItem(
"jio/localstorage/uremove/aremove/remove1/remove2", "fghi"); "jio/localstorage/uremove/aremove/remove1/remove2",
"fghi"
);
// remove attachment // remove attachment
o.spy(o, "value", {"ok": true, "id": "remove1"}, o.spy(o, "value", {"ok": true, "id": "remove1"},
...@@ -432,7 +434,7 @@ ...@@ -432,7 +434,7 @@
for (i = 0; i < m; i += 1) { for (i = 0; i < m; i += 1) {
o.fakeDoc = {}; o.fakeDoc = {};
o.fakeDoc._id = "doc_"+(i < 10 ? "0"+i : i); o.fakeDoc._id = "doc_" + (i < 10 ? "0" + i : i);
o.fakeDoc.title = o.titles[i]; o.fakeDoc.title = o.titles[i];
o.fakeDoc.year = o.years[i]; o.fakeDoc.year = o.years[i];
o.fakeDoc.author = o.director[i]; o.fakeDoc.author = o.director[i];
...@@ -447,7 +449,7 @@ ...@@ -447,7 +449,7 @@
util.jsonlocalstorage.setItem(o.localpath + "/doc_05/att", "abc"); util.jsonlocalstorage.setItem(o.localpath + "/doc_05/att", "abc");
} }
util.jsonlocalstorage.setItem( util.jsonlocalstorage.setItem(
o.localpath+"/doc_"+(i < 10 ? "0"+i : i), o.localpath + "/doc_" + (i < 10 ? "0" + i : i),
o.fakeDoc o.fakeDoc
); );
} }
...@@ -458,8 +460,8 @@ ...@@ -458,8 +460,8 @@
o.allDocsResponse.total_rows = 15; o.allDocsResponse.total_rows = 15;
for (i = 0; i < m; i += 1) { for (i = 0; i < m; i += 1) {
o.allDocsResponse.rows.push({ o.allDocsResponse.rows.push({
"id": "doc_"+(i < 10 ? "0"+i : i), "id": "doc_" + (i < 10 ? "0" + i : i),
"key": "doc_"+(i < 10 ? "0"+i : i), "key": "doc_" + (i < 10 ? "0" + i : i),
"value": {} "value": {}
}); });
} }
...@@ -481,11 +483,11 @@ ...@@ -481,11 +483,11 @@
o.allDocsResponse.total_rows = m; o.allDocsResponse.total_rows = m;
for (i = 0; i < m; i += 1) { for (i = 0; i < m; i += 1) {
o.allDocsResponse.rows.push({ o.allDocsResponse.rows.push({
"id": "doc_"+(i < 10 ? "0"+i : i), "id": "doc_" + (i < 10 ? "0" + i : i),
"key": "doc_"+(i < 10 ? "0"+i : i), "key": "doc_" + (i < 10 ? "0" + i : i),
"value": {}, "value": {},
"doc": util.jsonlocalstorage.getItem( "doc": util.jsonlocalstorage.getItem(
o.localpath+"/doc_"+(i < 10 ? "0"+i : i) o.localpath + "/doc_" + (i < 10 ? "0" + i : i)
) )
}); });
} }
...@@ -516,8 +518,8 @@ ...@@ -516,8 +518,8 @@
} }
}); });
o.thisShouldBeTheAnswer4.rows.sort(function (a, b) { o.thisShouldBeTheAnswer4.rows.sort(function (a, b) {
return a.value.year > b.value.year ? -1 : return (a.value.year > b.value.year ? -1 :
a.value.year < b.value.year ? 1 : 0; a.value.year < b.value.year ? 1 : 0);
}); });
o.thisShouldBeTheAnswer4.total_rows = 5; o.thisShouldBeTheAnswer4.total_rows = 5;
o.thisShouldBeTheAnswer4.rows.length = 5; o.thisShouldBeTheAnswer4.rows.length = 5;
...@@ -526,7 +528,7 @@ ...@@ -526,7 +528,7 @@
"allDocs (complex queries year >= 1980, all query options)"); "allDocs (complex queries year >= 1980, all query options)");
o.jio.allDocs({ o.jio.allDocs({
"query": '(year: >= "1980")', "query": '(year: >= "1980")',
"limit": [0,5], "limit": [0, 5],
"sort_on": [["year", "descending"]], "sort_on": [["year", "descending"]],
"select_list": ["title", "year"] "select_list": ["title", "year"]
}, o.f); }, o.f);
...@@ -541,8 +543,8 @@ ...@@ -541,8 +543,8 @@
o.thisShouldBeTheAnswer5.total_rows += 1; o.thisShouldBeTheAnswer5.total_rows += 1;
}); });
o.thisShouldBeTheAnswer5.rows.sort(function (a, b) { o.thisShouldBeTheAnswer5.rows.sort(function (a, b) {
return a.value.title > b.value.title ? -1 : return (a.value.title > b.value.title ? -1 :
a.value.title < b.value.title ? 1 : 0; a.value.title < b.value.title ? 1 : 0);
}); });
o.spy(o, "value", o.thisShouldBeTheAnswer5, o.spy(o, "value", o.thisShouldBeTheAnswer5,
......
...@@ -690,7 +690,7 @@ ...@@ -690,7 +690,7 @@
o.jio_id = o.jio.getId(); o.jio_id = o.jio.getId();
o.jio.put({"_id": "file", "title": "myFile"}, {"max_retry":3}, o.f); o.jio.put({"_id": "file", "title": "myFile"}, {"max_retry": 3}, o.f);
waitUntilLastJobIs("initial"); // "on going" or "wait" should work waitUntilLastJobIs("initial"); // "on going" or "wait" should work
// xxx also test with waitUntilLastJobIs("on going") ? // xxx also test with waitUntilLastJobIs("on going") ?
o.jio.close(); o.jio.close();
......
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