-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
33 lines (31 loc) · 826 Bytes
/
test.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
var test = require('tape');
var mongoose = require('mongoose');
var abstractBlobTests = require('abstract-blob-store/tests');
var BlobStore = require('./');
mongoose
.connect('mongodb://localhost/mongoose-blob-store', {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => {
test.onFinish(() => {
mongoose.connection.close();
});
const common = {
setup: function (t, cb) {
const store = BlobStore({
collection: 'attachments',
modelName: 'Attachment',
mongooseConnection: mongoose.connection,
});
cb(null, store);
},
teardown: function (t, store, blob, cb) {
if (blob) {
return store.remove(blob, cb);
}
return cb();
},
};
abstractBlobTests(test, common);
});