refactor(test): rename variable for INestApplicationContext

This commit is contained in:
syuilo 2023-03-12 20:57:01 +09:00
parent ba98abc97b
commit a43398ce1d
13 changed files with 39 additions and 39 deletions

View file

@ -9,7 +9,7 @@ import { signup, api, post, react, startServer, waitFire } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('2要素認証', () => { describe('2要素認証', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: unknown; let alice: unknown;
const config = loadConfig(); const config = loadConfig();
@ -163,12 +163,12 @@ describe('2要素認証', () => {
}; };
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username, password }); alice = await signup({ username, password });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('が設定でき、OTPでログインできる。', async () => { test('が設定でき、OTPでログインできる。', async () => {

View file

@ -5,14 +5,14 @@ import { signup, api, post, startServer } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('API visibility', () => { describe('API visibility', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
describe('Note visibility', () => { describe('Note visibility', () => {

View file

@ -5,20 +5,20 @@ import { signup, api, startServer } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('API', () => { describe('API', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let bob: any; let bob: any;
let carol: any; let carol: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
describe('General validation', () => { describe('General validation', () => {

View file

@ -5,7 +5,7 @@ import { signup, api, post, startServer } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Block', () => { describe('Block', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
// alice blocks bob // alice blocks bob
let alice: any; let alice: any;
@ -13,14 +13,14 @@ describe('Block', () => {
let carol: any; let carol: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('Block作成', async () => { test('Block作成', async () => {

View file

@ -8,7 +8,7 @@ import { startServer, signup, post, api, uploadFile, simpleGet } from '../utils.
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Endpoints', () => { describe('Endpoints', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let bob: any; let bob: any;
@ -16,7 +16,7 @@ describe('Endpoints', () => {
let dave: any; let dave: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
@ -24,7 +24,7 @@ describe('Endpoints', () => {
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
describe('signup', () => { describe('signup', () => {

View file

@ -16,13 +16,13 @@ const HTML = 'text/html; charset=utf-8';
const JSON_UTF8 = 'application/json; charset=utf-8'; const JSON_UTF8 = 'application/json; charset=utf-8';
describe('Fetch resource', () => { describe('Fetch resource', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let alicesPost: any; let alicesPost: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
alicesPost = await post(alice, { alicesPost = await post(alice, {
text: 'test', text: 'test',
@ -30,7 +30,7 @@ describe('Fetch resource', () => {
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
describe('Common', () => { describe('Common', () => {

View file

@ -5,19 +5,19 @@ import { signup, api, startServer, simpleGet } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('FF visibility', () => { describe('FF visibility', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let bob: any; let bob: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる', async () => { test('ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる', async () => {

View file

@ -5,7 +5,7 @@ import { signup, api, post, react, startServer, waitFire } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Mute', () => { describe('Mute', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
// alice mutes carol // alice mutes carol
let alice: any; let alice: any;
@ -13,14 +13,14 @@ describe('Mute', () => {
let carol: any; let carol: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('ミュート作成', async () => { test('ミュート作成', async () => {

View file

@ -6,14 +6,14 @@ import { signup, post, uploadUrl, startServer, initTestDb, api, uploadFile } fro
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Note', () => { describe('Note', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let Notes: any; let Notes: any;
let alice: any; let alice: any;
let bob: any; let bob: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
const connection = await initTestDb(true); const connection = await initTestDb(true);
Notes = connection.getRepository(Note); Notes = connection.getRepository(Note);
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
@ -21,7 +21,7 @@ describe('Note', () => {
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('投稿できる', async () => { test('投稿できる', async () => {

View file

@ -5,7 +5,7 @@ import { signup, api, post, react, startServer, waitFire } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Renote Mute', () => { describe('Renote Mute', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
// alice mutes carol // alice mutes carol
let alice: any; let alice: any;
@ -13,14 +13,14 @@ describe('Renote Mute', () => {
let carol: any; let carol: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('ミュート作成', async () => { test('ミュート作成', async () => {

View file

@ -6,7 +6,7 @@ import { connectStream, signup, api, post, startServer, initTestDb, waitFire } f
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Streaming', () => { describe('Streaming', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let Followings: any; let Followings: any;
const follow = async (follower: any, followee: any) => { const follow = async (follower: any, followee: any) => {
@ -38,7 +38,7 @@ describe('Streaming', () => {
let list: any; let list: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
const connection = await initTestDb(true); const connection = await initTestDb(true);
Followings = connection.getRepository(Following); Followings = connection.getRepository(Following);
@ -74,7 +74,7 @@ describe('Streaming', () => {
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
describe('Events', () => { describe('Events', () => {

View file

@ -5,21 +5,21 @@ import { signup, api, post, connectStream, startServer } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('Note thread mute', () => { describe('Note thread mute', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let bob: any; let bob: any;
let carol: any; let carol: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' }); bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' }); carol = await signup({ username: 'carol' });
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async () => { afterAll(async () => {
await p.close(); await app.close();
}); });
test('notes/mentions にミュートしているスレッドの投稿が含まれない', async () => { test('notes/mentions にミュートしているスレッドの投稿が含まれない', async () => {

View file

@ -5,7 +5,7 @@ import { signup, api, post, uploadUrl, startServer } from '../utils.js';
import type { INestApplicationContext } from '@nestjs/common'; import type { INestApplicationContext } from '@nestjs/common';
describe('users/notes', () => { describe('users/notes', () => {
let p: INestApplicationContext; let app: INestApplicationContext;
let alice: any; let alice: any;
let jpgNote: any; let jpgNote: any;
@ -13,7 +13,7 @@ describe('users/notes', () => {
let jpgPngNote: any; let jpgPngNote: any;
beforeAll(async () => { beforeAll(async () => {
p = await startServer(); app = await startServer();
alice = await signup({ username: 'alice' }); alice = await signup({ username: 'alice' });
const jpg = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg'); const jpg = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
const png = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.png'); const png = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.png');
@ -29,7 +29,7 @@ describe('users/notes', () => {
}, 1000 * 60 * 2); }, 1000 * 60 * 2);
afterAll(async() => { afterAll(async() => {
await p.close(); await app.close();
}); });
test('ファイルタイプ指定 (jpg)', async () => { test('ファイルタイプ指定 (jpg)', async () => {