Skip to content

Node.js based forum software built for the modern web

test: add some timeout to reward test to wait for action hooks to finish

Barış Soner Uşaklı7f6ed9ae3f7e
diff --git a/test/rewards.js b/test/rewards.js
index ed4b009748..225b7d6af2 100644
--- a/test/rewards.js
+++ b/test/rewards.js
@@ -1,6 +1,7 @@
'use strict';
const assert = require('assert');
+const { setTimout } = require('timers');
const db = require('./mocks/databasemock');
const meta = require('../src/meta');
@@ -80,6 +81,7 @@ describe('rewards', () => {
const uid = await User.create({ username: 'poster' });
await Topics.post({ uid, cid, title: 'test topic', content: 'test content' });
await Topics.post({ uid, cid, title: 'test topic 2', content: 'test content' });
+ await setTimeout(2000);
const reputation = await User.getUserField(uid, 'reputation');
assert.equal(reputation, 10);
await Topics.post({ uid, cid, title: 'test topic 3', content: 'test content' });