blob: 089a5247deb805fb6c7177dac7f7aab07e8e3b8f [file] [log] [blame]
'use strict';
if (!process.env.LEVEL_ADAPTER && !process.env.LEVEL_PREFIX) {
// these tests don't make sense for anything other than default leveldown
var fs = require('fs');
describe('Remove DB', function () {
afterEach(function (done) {
fs.unlink('./tmp/_pouch_veryimportantfiles/something', function () {
fs.rmdir('./tmp/_pouch_veryimportantfiles/', function () {
done();
});
});
});
it('Put a file in the db, then destroy it', function (done) {
new PouchDB('veryimportantfiles', function (err, db) {
fs.writeFile('./tmp/_pouch_veryimportantfiles/something',
new Buffer('lalala'), function (err) {
db.destroy(function (err) {
if (err) {
return done(err);
}
fs.readFile('./tmp/_pouch_veryimportantfiles/something',
{encoding: 'utf8'}, function (err, resp) {
if (err) {
return done(err);
}
resp.should
.equal('lalala',
'./tmp/veryimportantfiles/something was not removed');
done();
});
});
});
});
});
});
}