From e3610fa481b5c506ca0b69f49a6f350fce8b3399 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 11 Oct 2009 05:49:19 +0000 Subject: add create_target:true option to _replicate that creates the target database git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824029 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/replication.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'share/www/script/test/replication.js') diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js index 210ffa2c..78678937 100644 --- a/share/www/script/test/replication.js +++ b/share/www/script/test/replication.js @@ -277,4 +277,28 @@ couchTests.replication = function(debug) { T(result2.no_changes == true); T(result2.session_id == result.session_id); } + + // test optional automatic creation of the target db + + var dbA = new CouchDB("test_suite_db_a", {"X-Couch-Full-Commit":"false"}); + var dbB = new CouchDB("test_suite_db_b", {"X-Couch-Full-Commit":"false"}); + + dbA.deleteDb(); + dbA.createDb(); + dbB.deleteDb(); + + // local + CouchDB.replicate(dbA.name, "test_suite_db_b", { + body: {"create_target": true} + }); + TEquals("test_suite_db_b", dbB.info().db_name, + "Target database should exist"); + + // remote + dbB.deleteDb(); + CouchDB.replicate(dbA.name, "http://" + CouchDB.host + "/test_suite_db_b", { + body: {"create_target": true} + }); + TEquals("test_suite_db_b", dbB.info().db_name, + "Target database should exist"); }; -- cgit v1.2.3