forked from pouchdb/pouchdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.issue915.js
37 lines (37 loc) · 1.24 KB
/
test.issue915.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
if (!process.env.LEVEL_ADAPTER &&
!process.env.LEVEL_PREFIX && !process.env.AUTO_COMPACTION) {
// 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();
});
});
});
});
});
});
}