Skip to content

Node.js based forum software built for the modern web

test: fix tests to account for a460a55064e1280f36a0021e0510c7c557251030

Julian Lam948bfe46f1c0
diff --git a/test/activitypub/notes.js b/test/activitypub/notes.js
index afd24081c5..fbbf0c59ec 100644
--- a/test/activitypub/notes.js
+++ b/test/activitypub/notes.js
@@ -451,7 +451,7 @@ describe('Notes', () => {
assert.strictEqual(cid, -1);
});
- it('should create a new topic in cid -1 even if a remote category is addressed', async () => {
+ it('should create a new topic in a remote category if addressed (category same-origin)', async () => {
const { id: remoteCid } = helpers.mocks.group();
const { note, id } = helpers.mocks.note({
audience: [remoteCid],
@@ -462,6 +462,23 @@ describe('Notes', () => {
assert(await posts.exists(id));
+ const cid = await posts.getCidByPid(id);
+ assert.strictEqual(cid, remoteCid);
+ });
+
+ it('should create a new topic in cid -1 if a non-same origin remote category is addressed', async () => {
+ const { id: remoteCid } = helpers.mocks.group({
+ id: `https://example.com/${utils.generateUUID()}`,
+ });
+ const { note, id } = helpers.mocks.note({
+ audience: [remoteCid],
+ });
+ const { activity } = helpers.mocks.create(note);
+
+ await activitypub.inbox.create({ body: activity });
+
+ assert(await posts.exists(id));
+
const cid = await posts.getCidByPid(id);
assert.strictEqual(cid, -1);
});