11'use strict' ;
22
33var Promise = require ( 'sporks/scripts/promise' ) ,
4- Cluster = require ( '../scripts' ) ,
4+ Cluster = require ( '../scripts/cluster ' ) ,
55 sporks = require ( 'sporks' ) ,
66 Slouch = require ( 'couch-slouch' ) ;
77
@@ -11,7 +11,8 @@ describe('node and browser', function () {
1111 id = 0 ,
1212 cluster = null ,
1313 replicatedDBs = null ,
14- differentCluster = false ;
14+ differentCluster = false ,
15+ consoleLog = null ;
1516
1617 var data = {
1718 db1 : {
@@ -169,11 +170,15 @@ describe('node and browser', function () {
169170
170171 differentCluster = false ;
171172
173+ consoleLog = console . log ;
174+
172175 return createData ( ) ;
173176 } ) ;
174177
175178 afterEach ( function ( ) {
176- return destroyData ( ) ;
179+ return destroyData ( ) . then ( function ( ) {
180+ console . log = consoleLog ;
181+ } ) ;
177182 } ) ;
178183
179184 it ( 'should replicate' , function ( ) {
@@ -223,4 +228,28 @@ describe('node and browser', function () {
223228 } ) ;
224229 } ) ;
225230
231+ it ( 'should replicate with targets api' , function ( ) {
232+ return replicate ( {
233+ source : 'http://admin:admin@localhost:5984' ,
234+ target : 'http://admin:admin@localhost:5984' ,
235+ useTargetAPI : true
236+ } ) ;
237+ } ) ;
238+
239+ it ( 'should log when verbose on' , function ( ) {
240+ // Mock
241+ var msg = null ;
242+ console . log = function ( _msg ) {
243+ msg = _msg ;
244+ } ;
245+
246+ return replicate ( {
247+ source : 'http://admin:admin@localhost:5984' ,
248+ target : 'http://admin:admin@localhost:5984' ,
249+ verbose : true
250+ } ) . then ( function ( ) {
251+ ( msg === null ) . should . eql ( false ) ;
252+ } ) ;
253+ } ) ;
254+
226255} ) ;
0 commit comments