diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/activitypub.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/activitypub.ts b/test/activitypub.ts index 5699a8c8de..24b8d13b85 100644 --- a/test/activitypub.ts +++ b/test/activitypub.ts @@ -70,4 +70,34 @@ describe('ActivityPub', () => { assert.deepStrictEqual(note?.text, post.content); }); }); + + describe('Truncate long name', () => { + const host = 'https://host1.test'; + const preferredUsername = `${rndstr('A-Z', 4)}${rndstr('a-z', 4)}`; + const actorId = `${host}/users/${preferredUsername.toLowerCase()}`; + + const name = rndstr('0-9a-z', 129); + + const actor = { + '@context': 'https://www.w3.org/ns/activitystreams', + id: actorId, + type: 'Person', + preferredUsername, + name, + inbox: `${actorId}/inbox`, + outbox: `${actorId}/outbox`, + }; + + it('Actor', async () => { + const { MockResolver } = await import('./misc/mock-resolver'); + const { createPerson } = await import('../src/remote/activitypub/models/person'); + + const resolver = new MockResolver(); + resolver._register(actor.id, actor); + + const user = await createPerson(actor.id, resolver); + + assert.deepStrictEqual(user.name, actor.name.substr(0, 128)); + }); + }); }); |