From 2f961a029b0584b78999cba755bd0946426fa957 Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Wed, 11 Jan 2023 09:15:38 +0000 Subject: [PATCH] stub account blocks API --- backend/test/mastodon.spec.ts | 10 ++++++++++ functions/api/v1/blocks.ts | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 functions/api/v1/blocks.ts diff --git a/backend/test/mastodon.spec.ts b/backend/test/mastodon.spec.ts index 84a225d..564b406 100644 --- a/backend/test/mastodon.spec.ts +++ b/backend/test/mastodon.spec.ts @@ -4,6 +4,7 @@ import * as v2_instance from 'wildebeest/functions/api/v2/instance' import * as apps from 'wildebeest/functions/api/v1/apps' import * as custom_emojis from 'wildebeest/functions/api/v1/custom_emojis' import * as mutes from 'wildebeest/functions/api/v1/mutes' +import * as blocks from 'wildebeest/functions/api/v1/blocks' import { makeDB, assertCORS, assertJSON, assertCache, createTestClient } from './utils' import { createPerson } from 'wildebeest/backend/src/activitypub/actors' import { createSubscription } from '../src/mastodon/subscription' @@ -240,4 +241,13 @@ describe('Mastodon APIs', () => { const data = await res.json() assert.equal(data.length, 0) }) + + test('blocks returns an empty array', async () => { + const res = await blocks.onRequest() + assert.equal(res.status, 200) + assertJSON(res) + + const data = await res.json() + assert.equal(data.length, 0) + }) }) diff --git a/functions/api/v1/blocks.ts b/functions/api/v1/blocks.ts new file mode 100644 index 0000000..eaf1943 --- /dev/null +++ b/functions/api/v1/blocks.ts @@ -0,0 +1,8 @@ +const headers = { + 'content-type': 'application/json; charset=utf-8', +} + +export const onRequest = async () => { + const out: Array = [] + return new Response(JSON.stringify(out), { headers }) +}