mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 22:00:34 +01:00
test: dont clear local when testing
This commit is contained in:
@@ -28,8 +28,11 @@ const total = _.cloneDeep(local);
|
||||
|
||||
const runJobs = nconf.get('runJobs');
|
||||
|
||||
Analytics.pause = false;
|
||||
|
||||
Analytics.init = async function () {
|
||||
new cronJob('*/10 * * * * *', (async () => {
|
||||
if (Analytics.pause) return;
|
||||
publishLocalAnalytics();
|
||||
if (runJobs) {
|
||||
await sleep(2000);
|
||||
|
||||
@@ -126,9 +126,9 @@ describe('Analytics', () => {
|
||||
|
||||
it('should increment various metrics', async () => {
|
||||
let counters;
|
||||
analytics.pause = true;
|
||||
({ counters } = analytics.peek());
|
||||
const before = { ...counters };
|
||||
const { setTimeout } = require('timers/promises');
|
||||
const id = `https://example.org/activity/${utils.generateUUID()}`;
|
||||
await controllers.activitypub.postInbox({
|
||||
body: {
|
||||
@@ -141,7 +141,7 @@ describe('Analytics', () => {
|
||||
},
|
||||
},
|
||||
}, { sendStatus: () => {} });
|
||||
await setTimeout(2000);
|
||||
|
||||
({ counters } = analytics.peek());
|
||||
const after = { ...counters };
|
||||
|
||||
@@ -150,5 +150,6 @@ describe('Analytics', () => {
|
||||
assert(before[metric] && after[metric], JSON.stringify({ before, after }, null, 2));
|
||||
assert(before[metric] < after[metric]);
|
||||
});
|
||||
analytics.pause = false;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user