From 8ca34e74bd7715315f0cd76943e1044e9e0a134f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 19 Mar 2026 12:02:26 -0400 Subject: [PATCH] fix: improve idempotency of ap test --- test/activitypub/actors.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/activitypub/actors.js b/test/activitypub/actors.js index e659713de3..e185984c1b 100644 --- a/test/activitypub/actors.js +++ b/test/activitypub/actors.js @@ -737,6 +737,10 @@ describe('Pruning', () => { }); describe('Users', () => { + before(async function () { + this.current = await activitypub.actors.prune(); + }); + it('should do nothing if the user is newer than the prune cutoff', async () => { const { id: uid } = helpers.mocks.person(); await activitypub.actors.assert([uid]); @@ -762,7 +766,7 @@ describe('Pruning', () => { assert(result.counts.deleted >= 1); }); - it('should do nothing if the user has some content (e.g. a topic)', async () => { + it('should do nothing if the user has some content (e.g. a topic)', async function () { const { cid } = await categories.create({ name: utils.generateUUID() }); const { id: uid } = helpers.mocks.person(); const { id, note } = helpers.mocks.note({ @@ -776,7 +780,7 @@ describe('Pruning', () => { const result = await activitypub.actors.prune(); assert.strictEqual(result.counts.deleted, 0); - assert.strictEqual(result.counts.preserved, 1); + assert.strictEqual(result.counts.preserved, this.current.counts.preserved + 1); assert.strictEqual(result.counts.missing, 0); }); });