.then(function(docs) { testdoc1_revs.push(docs.db1.rows[0].value.rev); testdoc1_revs.push(docs.db2.rows[0].value.rev); testdoc2_revs.push(docs.db1.rows[1].value.rev); testdoc2_revs.push(docs.db2.rows[1].value.rev); return Promise.all([db1.destroy(), db2.destroy()]); })
after(function(done) { testRemoteDb.destroy().then(function() { testLocalDb.destroy().then(function() { done() }) }) })
setCompanies(data) { var companies = []; for (var i = 0; i < data.length; i++) { var company = data[i]; companies.push({ _id: company.siret, societe: company.societe, activite: company.activite, adresse: company.adresse, cp: company.cp, ville: company.ville, mobile: company.mobile, email: company.email, siret: company.siret, codeNaf: company.codeNaf, effectifs: company.effectifs, }); } this.companiesDB.destroy().then((response) => { // success, recreate db this.companiesDB = new PouchDB('companies'); // create docs this.companiesDB.bulkDocs(companies).then((result) => { // handle result }).catch((err) => { console.log(err); }); }).catch((err) => { console.log(err); }); }
it('disassociates from previous remote sync server when a new one is set', async () => { const card = { question: 'Question', answer: 'Answer', _id: CardStore.generateCardId(), created: JSON.parse(JSON.stringify(new Date())), }; const alternateRemote = new PouchDB('cards_remote_2', { db: memdown }); subject.changes.on( 'change', wrapAssertingFunction(() => { assert.fail( 'Did not expect update to be called on the previous remote' ); }) ); await subject.setSyncServer(testRemote); await subject.setSyncServer(alternateRemote); await testRemote.put(cardForDirectPut(card)); await waitForEvents(20); await alternateRemote.destroy(); });
app.del('/:db', function (req, res, next) { var name = encodeURIComponent(req.params.db); Pouch.destroy(protocol + name, function (err, info) { if (err) return res.send(404, err); delete dbs[name]; res.send(200, { ok: true }); }); });
destroyDB() { return this.companiesDB.destroy().then((response) => { console.log('destroyDB', response); //recreate this.companiesDB = new PouchDB('companies'); }).catch((err) => { console.log(err); }); }
function destroyDbs() { db.destroy().then(function (response) { console.log(response); console.log('done destroying.'); db.close(); }).catch(function (err) { console.log(err); db.close(); }); var refDb = new PouchDB('reference'); refDb.destroy().then(function (response) { console.log(response); console.log('done destroying refs.'); refDb.close(); }).catch(function (err) { console.log(err); refDb.close(); }); }
return previous.finally(function() { // console.log('Destroying database'); var userTestDB1 = new PouchDB(dbUrl + "/test_usertest$superuser"); var userTestDB2 = new PouchDB(dbUrl + "/test_usertest$misterx"); var userTestDB3 = new PouchDB(dbUrl + "/test_usertest$misterx3"); var userTestDB4 = new PouchDB(dbUrl + "/test_superdb"); return BPromise.all([userDB.destroy(), keysDB.destroy(), userTestDB1.destroy(), userTestDB2.destroy(), userTestDB3.destroy(), userTestDB4.destroy()]); });
it('does not report events from the old remote', async () => { const alternateRemote = new PouchDB('cards_remote_2', { db: memdown }); const callbacks = { onIdle: wrapAssertingFunction(() => { assert.fail('Did not expect pause to be called on the previous remote'); }), }; await subject.setSyncServer(testRemote, callbacks); await subject.setSyncServer(alternateRemote); await waitForEvents(20); await alternateRemote.destroy(); });
it('basic',function(done){ Pouch.destroy('basic',function(){ var db = Pouch('basic'); db.put(doc1,function(err){ db.put(doc2,function(err){ db.put(doc3,function(err){ db.put(doc4,function(err){ db.search(function(doc){ if(doc.desc){ index('default',doc.desc); } },{q:'land'},function(err,result){ result.total_rows.should.equal(1); done(); }); }); }); }); }); }); });
var wipeDB = function(done) { PouchDB.destroy(testUri).then(function() { done(); }); }
}).then(() => { return Promise.all([db1.destroy(), db2.destroy()]); }).then(() => {
}).then(function (response) { if (DEBUG) winston.info("Attempting to update couchDB "); return db.destroy(); }).then(function (info) {
after(function (done) { Pouch.destroy(testRemote, done); });
destroy(){ return this.db.destroy(); }
}).then(() => { t.equal(inSync(), true); return db.destroy(); }).then(() => {
}).catch(err => { // there should be no reducer document in store db // as it was never used t.equal(err.status, 404); return reducerDb.destroy(); }).then(() => {
self.destroy = function() { pouch.destroy(); };
afterEach(function () { this.timeout(30000); return Pouch.destroy(dbName); });
timeout(500).then(() => { return db.destroy(); }).then(() => {
}).then(() => { return db.destroy(); }).then(() => {
}).on('error', function (err) { // handle error console.info('error', err); }) .then(function(){ console.log('\n\n\nREPLICATION STOP'); // Print out all docs, local return localDb.allDocs() .then(function(data) { console.log(data.rows); }); }); }; var remoteSeq = -1; localDb.destroy() .then(function () { console.log('Wiped local db.'); localDb = new PouchDB('basicLocal'); return printInfoLocal(); }) .then(function() { return remoteDb.info() .then(function(info) { console.log(info.db_name, info.doc_count); remoteSeq = info.update_seq; console.log('remoteSeq', remoteSeq); }); }) // Fetch docs with a view. .then(function() {
without(names, '_replicator', '_users'), (name, i, l, cb) => { // Delete each db debug('Deleting db %s', name); const db = new PouchDB([server, name].join('/'), {}); db.destroy(cb); }, (err) => {
afterEach(function () { return Pouch.destroy(dbName); });
}).then(doc => { t.equal(store.getState().x, 4); t.equal(store.getState().y, 8); return db.destroy(); }).then(() => {
after(function () { return pouch.destroy(); });
store.clear = function () { return db.destroy(); };