From 359619b4cd3a6eaa83f69a16217258acafc8b28b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 3 May 2024 21:09:19 -0400 Subject: [PATCH] feat: add miscellany context; closes #169 Signed-off-by: Evan Prodromou --- index.mjs | 3 ++- index.test.mjs | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/index.mjs b/index.mjs index 5749b1b..c802288 100644 --- a/index.mjs +++ b/index.mjs @@ -68,7 +68,8 @@ const SEC_CONTEXT = 'https://w3id.org/security' const BLOCKED_CONTEXT = 'https://purl.archive.org/socialweb/blocked' const PENDING_CONTEXT = 'https://purl.archive.org/socialweb/pending' const WEBFINGER_CONTEXT = 'https://purl.archive.org/socialweb/webfinger' -const CONTEXT = [AS_CONTEXT, SEC_CONTEXT, BLOCKED_CONTEXT, PENDING_CONTEXT, WEBFINGER_CONTEXT] +const MISCELLANY_CONTEXT = 'https://purl.archive.org/socialweb/miscellany' +const CONTEXT = [AS_CONTEXT, SEC_CONTEXT, BLOCKED_CONTEXT, PENDING_CONTEXT, WEBFINGER_CONTEXT, MISCELLANY_CONTEXT] const LD_MEDIA_TYPE = 'application/ld+json' const ACTIVITY_MEDIA_TYPE = 'application/activity+json' diff --git a/index.test.mjs b/index.test.mjs index e6b88a5..bcc0576 100644 --- a/index.test.mjs +++ b/index.test.mjs @@ -5081,7 +5081,7 @@ describe('onepage.pub', { only: true }, () => { }) }) - describe('Actor has webfinger property', { only: true }, () => { + describe('Actor has webfinger property', () => { let actor1 = null before(async () => { [actor1] = await registerActor() @@ -5097,4 +5097,18 @@ describe('onepage.pub', { only: true }, () => { assert.strictEqual(obj.webfinger, `${actor1.preferredUsername}@localhost:${MAIN_PORT}`) }) }) + + describe('Actor has miscellany context', { only: true }, () => { + let actor1 = null + before(async () => { + [actor1] = await registerActor() + }) + it('Actor has miscellany context', { only: true }, async () => { + const obj = await getObject(actor1.id) + assert.strictEqual(typeof obj, 'object') + assert('@context' in obj) + assert(Array.isArray(obj['@context'])) + assert(obj['@context'].includes('https://purl.archive.org/socialweb/miscellany')) + }) + }) })