Skip to content

Node.js based forum software built for the modern web

test(activitypub): add cross-domain actorUri test for Helpers.query

Julian Lam26296e6cb79a
diff --git a/test/activitypub.js b/test/activitypub.js
index 5f3553c146..77d6acab50 100644
--- a/test/activitypub.js
+++ b/test/activitypub.js
@@ -152,6 +152,20 @@ describe('ActivityPub integration', () => {
const result = await activitypub.helpers.query('[email protected]');
assert(result);
});
+
+ it('should allow rel=self href to point to a different domain when subject hostname matches', async () => {
+ request.get = async () => ({
+ response: { statusCode: 200 },
+ body: {
+ subject: 'acct:[email protected]',
+ links: [{ rel: 'self', type: 'application/activity+json', href: 'https://otherdomain.com/actor' }],
+ },
+ });
+
+ const result = await activitypub.helpers.query('[email protected]');
+ assert(result);
+ assert.strictEqual(result.actorUri, 'https://otherdomain.com/actor');
+ });
});
describe('.generateKeys()', () => {