Skip to content

Node.js based forum software built for the modern web

fix: race condition in test

Barış Soner Uşaklı807a8c66db63
diff --git a/test/activitypub/analytics.js b/test/activitypub/analytics.js
index eda578b675..85c8792115 100644
--- a/test/activitypub/analytics.js
+++ b/test/activitypub/analytics.js
@@ -147,7 +147,8 @@ describe('Analytics', () => {
const metrics = ['activities', 'activities:byType:Like', 'activities:byHost:example.org'];
metrics.forEach((metric) => {
- assert(before[metric] && after[metric], JSON.stringify({ before, after }, null, 2));
+ before[metric] = before[metric] || 0;
+ assert(before.hasOwnProperty(metric) && after.hasOwnProperty(metric), JSON.stringify({ before, after }, null, 2));
assert(before[metric] < after[metric]);
});
analytics.pause = false;