enhance(backend): テストの高速化 (#12939)

* enhance(backend): テストの高速化

* add ls

* 自動的にマージされるようなので不要

* 起動方法を揃える

* fix test
This commit is contained in:
おさむのひと
2024-01-08 17:43:52 +09:00
committed by GitHub
parent 618e2ba1d2
commit 35ec41fc1e
45 changed files with 563 additions and 283 deletions

View File

@@ -6,24 +6,20 @@
process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import { inspect } from 'node:util';
import { DEFAULT_POLICIES } from '@/core/RoleService.js';
import type { Packed } from '@/misc/json-schema.js';
import {
signup,
post,
userList,
page,
role,
startServer,
api,
successfulApiCall,
failedApiCall,
uploadFile,
post,
role,
signup,
successfulApiCall,
testPaginationConsistency,
uploadFile,
userList,
} from '../utils.js';
import type * as misskey from 'misskey-js';
import type { INestApplicationContext } from '@nestjs/common';
const compareBy = <T extends { id: string }>(selector: (s: T) => string = (s: T): string => s.id) => (a: T, b: T): number => {
return selector(a).localeCompare(selector(b));
@@ -54,8 +50,6 @@ describe('アンテナ', () => {
withReplies: false,
};
let app: INestApplicationContext;
let root: User;
let alice: User;
let bob: User;
@@ -79,10 +73,6 @@ describe('アンテナ', () => {
let userMutingAlice: User;
let userMutedByAlice: User;
beforeAll(async () => {
app = await startServer();
}, 1000 * 60 * 2);
beforeAll(async () => {
root = await signup({ username: 'root' });
alice = await signup({ username: 'alice' });
@@ -136,10 +126,6 @@ describe('アンテナ', () => {
await api('mute/create', { userId: userMutedByAlice.id }, alice);
}, 1000 * 60 * 10);
afterAll(async () => {
await app.close();
});
beforeEach(async () => {
// テスト間で影響し合わないように毎回全部消す。
for (const user of [alice, bob]) {