Created
October 3, 2015 15:34
-
-
Save daleharvey/09d273f5d8502c8aa37a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('#4276 Triggers paused error', function (done) { | |
if (!(/http/.test(dbs.remote) && !/http/.test(dbs.name))) { | |
return done(); | |
} | |
var err = { | |
"message": "_writer access is required for this request", | |
"name": "unauthorized", | |
"status": 401 | |
}; | |
var ajax = PouchDB.utils.ajax; | |
PouchDB.utils.ajax = function (opts, cb) { | |
cb(err); | |
}; | |
var db = new PouchDB(dbs.name); | |
var remote = new PouchDB(dbs.remote); | |
db.bulkDocs([{foo: 'bar'}]).then(function() { | |
var repl = db.replicate.to(remote, {live: true, retry: true}); | |
repl.on('paused', function(err) { | |
if (err) { | |
repl.cancel(); | |
} | |
}); | |
repl.on('complete', function(res) { | |
PouchDB.utils.ajax = ajax; | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment