Skip to content

Commit

Permalink
more robust test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinse12 committed Nov 1, 2024
1 parent 3101fc8 commit 7cbf49b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/node/subplebbit/stats.subplebbit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ describe(`subplebbit.statsCid`, async () => {
});

it(`ActiveUserCount should increase by 1 for new vote author`, async () => {
const statsCidBefore = JSON.parse(JSON.stringify(subplebbit.statsCid));
const statsBefore = JSON.parse(await plebbit.fetchCid(subplebbit.statsCid));
const post = subplebbit.posts.pages.hot.comments[0];
const updatePromise = new Promise((resolve) => subplebbit.once("update", resolve));
await publishVote(post.cid, post.subplebbitAddress, 1, plebbit, { signer: signers[3] });
await updatePromise;
await resolveWhenConditionIsTrue(subplebbit, () => subplebbit.statsCid !== statsCidBefore);
const statsAfterNewVote = JSON.parse(await plebbit.fetchCid(subplebbit.statsCid));

for (const userCountKey of activeUserCountKeys) expect(statsAfterNewVote[userCountKey]).to.equal(statsBefore[userCountKey] + 1);
Expand Down

0 comments on commit 7cbf49b

Please sign in to comment.