fix tests

This commit is contained in:
Girish Ramakrishnan
2021-06-03 12:20:44 -07:00
parent c90a9e43cf
commit 8da4eaf4a3
27 changed files with 474 additions and 739 deletions

View File

@@ -7,30 +7,22 @@
'use strict';
const async = require('async'),
common = require('./common.js'),
database = require('../database.js'),
delay = require('delay'),
eventlog = require('../eventlog.js'),
expect = require('expect.js'),
notifications = require('../notifications.js');
function setup(done) {
// ensure data/config/mount paths
database.initialize(function (error) {
expect(error).to.be(null);
done();
});
}
function cleanup(done) {
async.series([
database._clear,
database.uninitialize
], done);
}
describe('Eventlog', function () {
before(setup);
after(cleanup);
before(function (done) {
async.series([
common.setup,
eventlog._clear // domain add events
], done);
});
after(common.cleanup);
var eventId;
@@ -38,6 +30,7 @@ describe('Eventlog', function () {
const id = await eventlog.add('some.event', { ip: '1.2.3.4' }, { appId: 'thatapp' });
expect(id).to.be.a('string');
console.log(id);
eventId = id;
});
@@ -126,7 +119,7 @@ describe('Eventlog', function () {
await notifications._add(eventId, 'title', 'some message');
}
await delay(2000);
await delay(3000);
const id = await eventlog.add('some.event', { ip: '1.2.3.4' }, { appId: 'thatapp' });