summaryrefslogtreecommitdiff
path: root/packages/backend/test/utils.ts
diff options
context:
space:
mode:
authorKisaragi <48310258+KisaragiEffective@users.noreply.github.com>2024-06-22 12:51:02 +0900
committerGitHub <noreply@github.com>2024-06-22 12:51:02 +0900
commitac12ab8629f0a0172250f949a98ee1efb1d0890d (patch)
treeac9b5d8ebf4ee0db28124f72e33c84f2c525bcb0 /packages/backend/test/utils.ts
parentenhance(frontend): WidgetInstanceInfo.vue と WidgetProfile.vue のスタイ... (diff)
downloadmisskey-ac12ab8629f0a0172250f949a98ee1efb1d0890d.tar.gz
misskey-ac12ab8629f0a0172250f949a98ee1efb1d0890d.tar.bz2
misskey-ac12ab8629f0a0172250f949a98ee1efb1d0890d.zip
fix(backend): フィードのノートのMFMはHTMLにレンダーしてから返す (#14006)
* fix(backend): フィードのノートのMFMはHTMLにレンダーしてから返す (test wip) * chore: beforeEachを使う? * fix: プレーンテキストにフォールバックしてMFMが含まれていないか調べる方針を実装 * fix: application/jsonだとパースされるのでその作用をキャンセル * build: fix lint error * docs: update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/test/utils.ts')
-rw-r--r--packages/backend/test/utils.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts
index 86814fffe0..aad4ab37c9 100644
--- a/packages/backend/test/utils.ts
+++ b/packages/backend/test/utils.ts
@@ -17,6 +17,7 @@ import { validateContentTypeSetAsActivityPub } from '@/core/activitypub/misc/val
import { entities } from '../src/postgres.js';
import { loadConfig } from '../src/config.js';
import type * as misskey from 'misskey-js';
+import { type Response } from 'node-fetch';
export { server as startServer, jobQueue as startJobQueue } from '@/boot/common.js';
@@ -454,7 +455,7 @@ export type SimpleGetResponse = {
type: string | null,
location: string | null
};
-export const simpleGet = async (path: string, accept = '*/*', cookie: any = undefined): Promise<SimpleGetResponse> => {
+export const simpleGet = async (path: string, accept = '*/*', cookie: any = undefined, bodyExtractor: (res: Response) => Promise<string | null> = _ => Promise.resolve(null)): Promise<SimpleGetResponse> => {
const res = await relativeFetch(path, {
headers: {
Accept: accept,
@@ -482,7 +483,7 @@ export const simpleGet = async (path: string, accept = '*/*', cookie: any = unde
const body =
jsonTypes.includes(res.headers.get('content-type') ?? '') ? await res.json() :
htmlTypes.includes(res.headers.get('content-type') ?? '') ? new JSDOM(await res.text()) :
- null;
+ await bodyExtractor(res);
return {
status: res.status,