Skip to content

Node.js based forum software built for the modern web

fix: failing test due to expected thrown exception

Julian Lam5f5fa0930d43
diff --git a/test/activitypub/inbox.js b/test/activitypub/inbox.js
index f70d10db79..0a4c46691d 100644
--- a/test/activitypub/inbox.js
+++ b/test/activitypub/inbox.js
@@ -464,7 +464,11 @@ describe('Inbox', () => {
const object = await activitypub.mocks.notes.public(this.postData);
const { activity } = helpers.mocks.like({ object });
this.voterUid = activity.actor;
- await activitypub.inbox.like({ body: activity });
+ try {
+ await activitypub.inbox.like({ body: activity });
+ } catch (e) {
+ // expected
+ }
});
after(async function () {
diff --git a/test/activitypub/privileges.js b/test/activitypub/privileges.js
index db6579ac5c..134be6c46f 100644
--- a/test/activitypub/privileges.js
+++ b/test/activitypub/privileges.js
@@ -122,7 +122,10 @@ describe('Privilege logic for remote users/content (ActivityPub)', () => {
object: note,
}));
- await activitypub.inbox.update({ body: activity });
+ assert.rejects(
+ activitypub.inbox.update({ body: activity }),
+ { message: '[[error:no-privileges]]' },
+ );
const postData = await posts.getPostData(note.id);
assert.strictEqual(postData.content, oldContent);
@@ -154,7 +157,10 @@ describe('Privilege logic for remote users/content (ActivityPub)', () => {
it('should ignore remote deletion of said note', async () => {
({ activity } = helpers.mocks.delete({ object: note }));
- await activitypub.inbox.delete({ body: activity });
+ assert.rejects(
+ activitypub.inbox.delete({ body: activity }),
+ { message: '[[error:no-privileges]]' },
+ );
const exists = await posts.exists(note.id);
assert.strictEqual(exists, true);