mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 23:44:57 +02:00
* refactor(gh): CI用スクリプトをpackageとして整理 * fix * fix * fix * fix * fix * fix * fix * remove old scripts * migrate * refactor 1 * refactor 2 * fix comment * fix * fix * fix * fix * remove vite-node from changelog-checker * fix lint * fix * refactor * update deps * fix * spec: rename packages
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { readFile } from 'node:fs/promises';
|
|
import { join } from 'node:path';
|
|
import { expect, test } from 'vitest';
|
|
import { renderMemoryReportMarkdown } from '../src/report/markdown';
|
|
import type { MemoryReport } from '../src/types';
|
|
|
|
const fixturesDir = join(import.meta.dirname, 'fixtures');
|
|
|
|
async function loadFixture(name: string) {
|
|
return JSON.parse(await readFile(join(fixturesDir, `${name}.json`), 'utf8')) as MemoryReport;
|
|
}
|
|
|
|
/**
|
|
* 出力をゴールデンファイルで固定する。
|
|
* 意図的に変更したときは `vitest -u` で更新し、__snapshots__ の差分もレビューすること。
|
|
*/
|
|
test('renders the backend memory report', async () => {
|
|
const markdown = renderMemoryReportMarkdown(await loadFixture('base'), await loadFixture('head'), {
|
|
baseHeapSnapshotUrl: 'https://example.invalid/base',
|
|
headHeapSnapshotUrl: 'https://example.invalid/head',
|
|
});
|
|
|
|
await expect(markdown).toMatchFileSnapshot('./__snapshots__/render-md.md');
|
|
});
|