From 881a6724adc06a8053a02f220f2d6ea203ffa5ed Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 1 Apr 2025 14:02:16 -0400 Subject: [PATCH] test: additional test for ensuring handle:uid is continually set even after re-assertion --- test/activitypub/actors.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/activitypub/actors.js b/test/activitypub/actors.js index 0a3ca34e60..ed2bebfc1a 100644 --- a/test/activitypub/actors.js +++ b/test/activitypub/actors.js @@ -175,6 +175,29 @@ describe('Actor asserton', () => { }) }); + describe('less happy paths', () => { + describe('actor with `preferredUsername` that is not all lowercase', () => { + it('should save a handle-to-uid association', async () => { + const preferredUsername = 'nameWITHCAPS'; + const { id } = helpers.mocks.person({ preferredUsername }); + await activitypub.actors.assert([id]); + + const uid = await db.getObjectField('handle:uid', `${preferredUsername.toLowerCase()}@example.org`); + assert.strictEqual(uid, id); + }); + + it('should preserve that association when re-asserted', async () => { + const preferredUsername = 'nameWITHCAPS'; + const { id } = helpers.mocks.person({ preferredUsername }); + await activitypub.actors.assert([id]); + await activitypub.actors.assert([id], { update: true }); + + const uid = await db.getObjectField('handle:uid', `${preferredUsername.toLowerCase()}@example.org`); + assert.strictEqual(uid, id); + }) + }); + }); + describe('edge cases: loopback handles and uris', () => { let uid; const userslug = utils.generateUUID().slice(0, 8); @@ -335,7 +358,7 @@ describe('as:Group', () => { assert.strictEqual(activity.object, cid); }); - it.only('should not show up in the user\'s following list', async () => { + it('should not show up in the user\'s following list', async () => { await user.setCategoryWatchState(uid, cid, categories.watchStates.watching); // Trigger inbox accept