couchdb-harness
Advanced tools
Comparing version 0.1.2 to 0.1.3
16
index.js
@@ -24,6 +24,3 @@ "use strict"; | ||
'javascript/tests/batch_save.js', | ||
'javascript/tests/bulk_docs.js', | ||
'javascript/tests/coffee.js', | ||
'javascript/tests/compact.js', | ||
'javascript/tests/config.js', | ||
'javascript/tests/conflicts.js', | ||
@@ -51,22 +48,11 @@ 'javascript/tests/cookie_auth.js', | ||
'javascript/tests/replication.js', | ||
'javascript/tests/replicator_db_bad_rep_id.js', | ||
'javascript/tests/replicator_db_by_doc_id.js', | ||
'javascript/tests/replicator_db_compact_rep_db.js', | ||
'javascript/tests/replicator_db_continuous.js', | ||
'javascript/tests/replicator_db_credential_delegation.js', | ||
'javascript/tests/replicator_db_field_validation.js', | ||
'javascript/tests/replicator_db_filtered.js', | ||
'javascript/tests/replicator_db_identical_continuous.js', | ||
'javascript/tests/replicator_db_identical.js', | ||
'javascript/tests/replicator_db_invalid_filter.js', | ||
'javascript/tests/replicator_db_security.js', | ||
'javascript/tests/replicator_db_simple.js', | ||
'javascript/tests/replicator_db_successive.js', | ||
'javascript/tests/replicator_db_survives.js', | ||
'javascript/tests/replicator_db_swap_rep_db.js', | ||
'javascript/tests/replicator_db_update_security.js', | ||
'javascript/tests/replicator_db_user_ctx.js', | ||
'javascript/tests/replicator_db_write_auth.js', | ||
'javascript/tests/rev_stemming.js', | ||
'javascript/tests/rewrite.js', | ||
'javascript/tests/security_validation.js', | ||
@@ -124,3 +110,3 @@ 'javascript/tests/show_documents.js', | ||
var files = [ | ||
'couchdb-harness-skip.js', | ||
'couchdb-harness-extra.js', | ||
'javascript/json2.js', | ||
@@ -127,0 +113,0 @@ 'javascript/sha1.js', |
@@ -52,3 +52,5 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
T(results.length == 5); | ||
T(results[0].id == "0"); | ||
skip("PoucDB bug: errors in bulkDocs don't have an 'id'", function () { | ||
T(results[0].id == "0"); | ||
}); | ||
T(results[0].error == "conflict"); | ||
@@ -73,12 +75,14 @@ T(typeof results[0].rev === "undefined"); // no rev member when a conflict | ||
// Now save the bulk docs, When we use all_or_nothing, we don't get conflict | ||
// checking, all docs are saved regardless of conflict status, or none are | ||
// saved. | ||
results = db.bulkSave(docs,{all_or_nothing:true}); | ||
T(results.error === undefined); | ||
skip("all_or_nothing is unsupported in PouchDB", function () { | ||
// Now save the bulk docs, When we use all_or_nothing, we don't get conflict | ||
// checking, all docs are saved regardless of conflict status, or none are | ||
// saved. | ||
results = db.bulkSave(docs,{all_or_nothing:true}); | ||
T(results.error === undefined); | ||
var doc = db.open("0", {conflicts:true}); | ||
var docConflict = db.open("0", {rev:doc._conflicts[0]}); | ||
var doc = db.open("0", {conflicts:true}); | ||
var docConflict = db.open("0", {rev:doc._conflicts[0]}); | ||
T(doc.shooby == "dooby" || docConflict.shooby == "dooby"); | ||
T(doc.shooby == "dooby" || docConflict.shooby == "dooby"); | ||
}); | ||
@@ -85,0 +89,0 @@ // verify creating a document with no id returns a new id |
@@ -34,7 +34,11 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
var originalsize = db.info().disk_size; | ||
var originaldatasize = db.info().data_size; | ||
skip("db.info().data_size isn't supported in PouchDB-Server", function () { | ||
var originaldatasize = db.info().data_size; | ||
}); | ||
var start_time = db.info().instance_start_time; | ||
TEquals("number", typeof originaldatasize, "data_size is a number"); | ||
T(originaldatasize < originalsize, "data size is < then db file size"); | ||
skip("db.info().data_size isn't supported in PouchDB-Server", function () { | ||
TEquals("number", typeof originaldatasize, "data_size is a number"); | ||
T(originaldatasize < originalsize, "data size is < then db file size"); | ||
}); | ||
@@ -46,4 +50,8 @@ for(var i in docs) { | ||
var deletesize = db.info().disk_size; | ||
T(deletesize > originalsize); | ||
T(db.setDbProperty("_revs_limit", 666).ok); | ||
skip("No db size guarantees for PouchDB server", function () { | ||
T(deletesize > originalsize); | ||
}); | ||
skip("PouchDB doesn't support _revs_limit", function () { | ||
T(db.setDbProperty("_revs_limit", 666).ok); | ||
}); | ||
@@ -54,4 +62,7 @@ T(db.compact().ok); | ||
while (db.info().compact_running) {}; | ||
warn("PouchDB Server doesn't implement db.info().compact_running!"); | ||
T(db.info().instance_start_time == start_time); | ||
T(db.getDbProperty("_revs_limit") === 666); | ||
skip("PouchDB doesn't support _revs_limit", function () { | ||
T(db.getDbProperty("_revs_limit") === 666); | ||
}); | ||
@@ -64,6 +75,10 @@ T(db.ensureFullCommit().ok); | ||
T(db.info().doc_count == 1); | ||
T(db.info().disk_size < deletesize); | ||
TEquals("number", typeof db.info().data_size, "data_size is a number"); | ||
T(db.info().data_size < db.info().disk_size, "data size is < then db file size"); | ||
skip("No db size guarantees for PouchDB server", function () { | ||
T(db.info().disk_size < deletesize); | ||
}); | ||
skip("db.info().data_size isn't supported in PouchDB-Server", function () { | ||
TEquals("number", typeof db.info().data_size, "data_size is a number"); | ||
T(db.info().data_size < db.info().disk_size, "data size is < then db file size"); | ||
}); | ||
}; |
@@ -54,6 +54,8 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
T(config.couchdb.database_dir); | ||
T(config.daemons.httpd); | ||
T(config.httpd_global_handlers._config); | ||
// T(config.log.level); | ||
T(config.query_servers.javascript); | ||
skip("PouchDB server doesn't support config.daemons, config.httpd_global_handlers, config.query_servers", function () { | ||
T(config.daemons.httpd); | ||
T(config.httpd_global_handlers._config); | ||
// T(config.log.level); | ||
T(config.query_servers.javascript); | ||
}); | ||
@@ -93,26 +95,28 @@ // test that settings can be altered, and that an undefined whitelist allows any change | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=nothanks",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(400, xhr.status, "CouchDB rejects an invalid 'raw' option"); | ||
skip("PouchDB server doesn't support the raw config option", function () { | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=nothanks",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(400, xhr.status, "CouchDB rejects an invalid 'raw' option"); | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=true",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(200, xhr.status, "Set an raw, pre-hashed admin password"); | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=true",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(200, xhr.status, "Set an raw, pre-hashed admin password"); | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=false",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(200, xhr.status, "Set an admin password with raw=false"); | ||
xhr = CouchDB.request("PUT", "/_config/admins/administrator?raw=false",{ | ||
body : JSON.stringify(password_hashed), | ||
headers: {"X-Couch-Persist": "false"} | ||
}); | ||
TEquals(200, xhr.status, "Set an admin password with raw=false"); | ||
// The password is literally the string "-pbkdf2-abcd...". | ||
T(CouchDB.login("administrator", password_hashed).ok); | ||
// The password is literally the string "-pbkdf2-abcd...". | ||
T(CouchDB.login("administrator", password_hashed).ok); | ||
xhr = CouchDB.request("GET", "/_config/admins/administrator"); | ||
T(password_hashed != JSON.parse(xhr.responseText), | ||
"Hashed password was not stored as a raw string"); | ||
xhr = CouchDB.request("GET", "/_config/admins/administrator"); | ||
T(password_hashed != JSON.parse(xhr.responseText), | ||
"Hashed password was not stored as a raw string"); | ||
}); | ||
@@ -119,0 +123,0 @@ xhr = CouchDB.request("DELETE", "/_config/admins/administrator",{ |
@@ -50,5 +50,7 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
var tasks = JSON.parse(CouchDB.request("GET", "/_active_tasks").responseText); | ||
TEquals(1, tasks.length, "1 active task"); | ||
TEquals(repDoc._id, tasks[0].doc_id, "replication doc id in active tasks"); | ||
skip("PouchDB Server doesn't support /_active_tasks", function () { | ||
var tasks = JSON.parse(CouchDB.request("GET", "/_active_tasks").responseText); | ||
TEquals(1, tasks.length, "1 active task"); | ||
TEquals(repDoc._id, tasks[0].doc_id, "replication doc id in active tasks"); | ||
}); | ||
@@ -138,2 +140,2 @@ // add another doc to source, it will be replicated to target | ||
dbB.deleteDb(); | ||
} | ||
} |
@@ -52,11 +52,15 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
var stats = repDoc1._replication_stats; | ||
TEquals(docs1.length, stats.revisions_checked, | ||
"right # of revisions_checked"); | ||
TEquals(docs1.length, stats.missing_revisions_found, | ||
"right # of missing_revisions_found"); | ||
skip("PouchDB doesn't support some of the detailed replication info", function () { | ||
TEquals(docs1.length, stats.revisions_checked, | ||
"right # of revisions_checked"); | ||
TEquals(docs1.length, stats.missing_revisions_found, | ||
"right # of missing_revisions_found"); | ||
}); | ||
TEquals(docs1.length, stats.docs_read, "right # of docs_read"); | ||
TEquals(docs1.length, stats.docs_written, "right # of docs_written"); | ||
TEquals(0, stats.doc_write_failures, "right # of doc_write_failures"); | ||
TEquals(dbA.info().update_seq, stats.checkpointed_source_seq, | ||
"right checkpointed_source_seq"); | ||
skip("PouchDB doesn't support some of the detailed replication info", function () { | ||
TEquals(dbA.info().update_seq, stats.checkpointed_source_seq, | ||
"right checkpointed_source_seq"); | ||
}); | ||
} | ||
@@ -115,2 +119,2 @@ | ||
dbB.deleteDb(); | ||
} | ||
} |
@@ -54,11 +54,15 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
var stats = repDoc1_copy._replication_stats; | ||
TEquals(docs1.length, stats.revisions_checked, | ||
"right # of revisions_checked"); | ||
TEquals(docs1.length, stats.missing_revisions_found, | ||
"right # of missing_revisions_found"); | ||
skip("PouchDB doesn't support some of the detailed replication info", function () { | ||
TEquals(docs1.length, stats.revisions_checked, | ||
"right # of revisions_checked"); | ||
TEquals(docs1.length, stats.missing_revisions_found, | ||
"right # of missing_revisions_found"); | ||
}); | ||
TEquals(docs1.length, stats.docs_read, "right # of docs_read"); | ||
TEquals(docs1.length, stats.docs_written, "right # of docs_written"); | ||
TEquals(0, stats.doc_write_failures, "right # of doc_write_failures"); | ||
TEquals(dbA.info().update_seq, stats.checkpointed_source_seq, | ||
"right checkpointed_source_seq"); | ||
skip("PouchDB doesn't support some of the detailed replication info", function () { | ||
TEquals(dbA.info().update_seq, stats.checkpointed_source_seq, | ||
"right checkpointed_source_seq"); | ||
}); | ||
@@ -128,2 +132,2 @@ var newDoc = { | ||
dbB.deleteDb(); | ||
} | ||
} |
@@ -414,3 +414,5 @@ // Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
T(result['_id'] == "_design/test"); | ||
T(typeof(result['_revs_info']) === "object"); | ||
skip("PouchDB.prototype.get() doesn't support the meta option", function () { | ||
T(typeof(result['_revs_info']) === "object"); | ||
}); | ||
@@ -425,5 +427,7 @@ // test path relative to server | ||
var xhr = CouchDB.request("GET", "/"+dbName+"/_design/test/_rewrite/uuids"); | ||
T(xhr.status == 500); | ||
var result = JSON.parse(xhr.responseText); | ||
T(result.error == "insecure_rewrite_rule"); | ||
skip("PouchDB server doesn't support secure rewriting", function () { | ||
T(xhr.status == 500); | ||
var result = JSON.parse(xhr.responseText); | ||
T(result.error == "insecure_rewrite_rule"); | ||
}); | ||
@@ -430,0 +434,0 @@ run_on_modified_server( |
{ | ||
"name": "couchdb-harness", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A generalized port of the CouchDB JavaScript test harness.", | ||
@@ -5,0 +5,0 @@ "repository": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
749089
16162
2