Node.js based forum software built for the modern web
fix: activitypub tests
Julian Lam12fb205b0989
diff --git a/test/activitypub.js b/test/activitypub.jsindex c470ca74ef..9fa2c757af 100644--- a/test/activitypub.js+++ b/test/activitypub.js@@ -11,6 +11,7 @@ const request = require('../src/request');const file = require('../src/file');const install = require('../src/install');+const privileges = require('../src/privileges');const meta = require('../src/meta');const user = require('../src/user');const categories = require('../src/categories');@@ -358,9 +359,12 @@ describe('ActivityPub integration', () => {assert(saved.tid);topic = await topics.getTopicData(saved.tid);- assert(topic);- assert.strictEqual(saved.uid, 'https://example.org/user/foobar');- assert.strictEqual(saved.content, '<b>Baz quux</b>');+ const { uid, mainPid } = topic;+ assert(uid && mainPid);+ const { content, sourceContent } = await posts.getPostData(mainPid);+ assert.strictEqual(uid, 'https://example.org/user/foobar');+ assert.strictEqual(content, '');+ assert.strictEqual(sourceContent, '**Baz quux**');});it('should properly save the topic title in the topic hash', async () => {@@ -501,7 +505,7 @@ describe('ActivityPub integration', () => {it('should return true if successfully asserted', async () => {const result = await activitypub.actors.assert([actorUri]);- assert(result);+ assert(result && result.length);});it('should contain a representation of that remote user in the database', async () => {diff --git a/test/activitypub/webfinger.js b/test/activitypub/webfinger.jsindex 9e503ebfc3..c408000e9e 100644--- a/test/activitypub/webfinger.js+++ b/test/activitypub/webfinger.js@@ -34,12 +34,12 @@ describe('WebFinger endpoint', () => {});it('should return 403 Forbidden if the calling user is not allowed to view the user list/profiles', async () => {- await privileges.global.rescind(['groups:view:users'], 'guests');+ await privileges.global.rescind(['groups:view:users'], 'fediverse');const { response } = await request.get(`${nconf.get('url')}/.well-known/webfinger?resource=acct%3a${slug}%40${host}`);assert(response);assert.strictEqual(response.statusCode, 400);- await privileges.global.give(['groups:view:users'], 'guests');+ await privileges.global.give(['groups:view:users'], 'fediverse');});it('should return a valid WebFinger response otherwise', async () => {diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.jsindex 507f29d6fc..587dd65dcc 100644--- a/test/mocks/databasemock.js+++ b/test/mocks/databasemock.js@@ -246,6 +246,7 @@ async function giveDefaultGlobalPrivileges() {await privileges.global.give(['groups:view:users', 'groups:view:tags', 'groups:view:groups',], 'guests');+ await privileges.global.give(['groups:view:users'], 'fediverse');}async function enableDefaultPlugins() {