summaryrefslogtreecommitdiff
path: root/share/www/script/test
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-08-18 14:48:03 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-08-18 14:48:03 +0000
commit7499f6c0547b4ec35d60df390d835615f7de06e6 (patch)
treeeda1731ad41f5ab933a7ef7d7b345bb683199421 /share/www/script/test
parent3b9a900cabff50c0c48aaf454dde0a0f1cc3545e (diff)
continuous _changes are now newline-delimited JSON Objects (no commas)
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@805430 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r--share/www/script/test/changes.js31
1 files changed, 14 insertions, 17 deletions
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js
index edf3ed18..e7721cbb 100644
--- a/share/www/script/test/changes.js
+++ b/share/www/script/test/changes.js
@@ -45,9 +45,9 @@ couchTests.changes = function(debug) {
req = CouchDB.request("GET", "/test_suite_db/_changes?feed=continuous&timeout=10");
- var resp = JSON.parse(req.responseText);
- T(resp.results.length == 1 && resp.last_seq==1)
- T(resp.results[0].changes[0].rev == docFoo._rev)
+ var lines = req.responseText.split("\n");
+ T(JSON.parse(lines[0]).changes[0].rev == docFoo._rev);
+ T(JSON.parse(lines[1]).last_seq == 1);
var xhr;
@@ -67,14 +67,6 @@ couchTests.changes = function(debug) {
T(JSON.parse(req.responseText).ok == true);
}
- var parse_changes_line = function(line) {
- if (line.charAt(line.length-1) == ",") {
- line = line.substring(0, line.length-1);
- }
- return JSON.parse(line);
- }
-
-
xhr.open("GET", "/test_suite_db/_changes?feed=continuous", true);
xhr.send("");
@@ -83,15 +75,13 @@ couchTests.changes = function(debug) {
sleep(100);
var lines = xhr.responseText.split("\n");
-
- T(lines[0]='{"results":[');
-
- var change = parse_changes_line(lines[1]);
+
+ var change = JSON.parse(lines[0]);
T(change.seq == 1)
T(change.id == "foo")
- change = parse_changes_line(lines[2]);
+ change = JSON.parse(lines[1]);
T(change.seq == 2)
T(change.id == "bar")
@@ -103,7 +93,7 @@ couchTests.changes = function(debug) {
sleep(100);
var lines = xhr.responseText.split("\n");
- change = parse_changes_line(lines[3]);
+ change = JSON.parse(lines[2]);
T(change.seq == 3);
T(change.id == "baz");
@@ -148,6 +138,13 @@ couchTests.changes = function(debug) {
var lines = xhr.responseText.split("\n");
+ var parse_changes_line = function(line) {
+ if (line.charAt(line.length-1) == ",") {
+ line = line.substring(0, line.length-1);
+ }
+ return JSON.parse(line);
+ }
+
change = parse_changes_line(lines[1]);
T(change.seq == 4);