fix: race condition in test

This commit is contained in:
Barış Soner Uşaklı
2025-03-22 12:12:35 -04:00
parent cab8ab9b7b
commit 807a8c66db

View File

@@ -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;