fix tests
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const async = require('async'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
database = require('../database.js'),
|
||||
const BoxError = require('../boxerror.js'),
|
||||
common = require('./common.js'),
|
||||
delay = require('delay'),
|
||||
expect = require('expect.js'),
|
||||
notifications = require('../notifications.js'),
|
||||
safe = require('safetydance');
|
||||
@@ -20,23 +20,9 @@ const EVENT_0 = {
|
||||
data: {}
|
||||
};
|
||||
|
||||
function setup(done) {
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
], done);
|
||||
}
|
||||
|
||||
function cleanup(done) {
|
||||
async.series([
|
||||
database._clear,
|
||||
database.uninitialize
|
||||
], done);
|
||||
}
|
||||
|
||||
describe('Notifications', function () {
|
||||
before(setup);
|
||||
after(cleanup);
|
||||
before(common.setup);
|
||||
after(common.cleanup);
|
||||
|
||||
let notificationIds = [];
|
||||
|
||||
@@ -46,6 +32,7 @@ describe('Notifications', function () {
|
||||
expect(error).to.equal(null);
|
||||
expect(id).to.be.a('string');
|
||||
notificationIds.push(id);
|
||||
await delay(1000);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,9 +52,9 @@ describe('Notifications', function () {
|
||||
it('can list notifications', async function () {
|
||||
const result = await notifications.list({}, 1, 10);
|
||||
expect(result.length).to.be(3);
|
||||
expect(result[0].title).to.be('title 0');
|
||||
expect(result[0].title).to.be('title 2');
|
||||
expect(result[1].title).to.be('title 1');
|
||||
expect(result[2].title).to.be('title 2');
|
||||
expect(result[2].title).to.be('title 0');
|
||||
});
|
||||
|
||||
it('can update notification', async function () {
|
||||
|
||||
Reference in New Issue
Block a user