replace delay.js with timers/promises

This commit is contained in:
Girish Ramakrishnan
2023-05-14 10:53:50 +02:00
parent 75ba20201e
commit 500d2361ec
14 changed files with 82 additions and 109 deletions

View File

@@ -8,10 +8,10 @@
const common = require('./common.js'),
database = require('../database.js'),
delay = require('../delay.js'),
eventlog = require('../eventlog.js'),
expect = require('expect.js'),
notifications = require('../notifications.js');
notifications = require('../notifications.js'),
timers = require('timers/promises');
describe('Eventlog', function () {
const { setup, cleanup } = common;
@@ -89,7 +89,7 @@ describe('Eventlog', function () {
let result = await eventlog.get(loginEventId);
const oldCreationTime = result.creationTime;
await delay(2000);
await timers.setTimeout(2000);
result = await eventlog.upsertLoginEvent('user.login', { ip: '1.2.3.4' }, { appId: 'thatapp' });
expect(result).to.equal(loginEventId);
@@ -117,7 +117,7 @@ describe('Eventlog', function () {
await notifications._add('title', 'some message', { eventId });
}
await delay(3000);
await timers.setTimeout(3000);
const id = await eventlog.add(eventlog.ACTION_USER_LOGIN, { ip: '1.2.3.4' }, { appId: 'thatapp' });