refactor: use test

This commit is contained in:
syuilo 2023-02-02 18:18:25 +09:00
parent 07f885fea8
commit ed3e035ad6
23 changed files with 342 additions and 342 deletions

View file

@ -54,7 +54,7 @@ describe('FileInfoService', () => {
await app.close();
});
it('Empty file', async () => {
test('Empty file', async () => {
const path = `${resources}/emptyfile`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -74,7 +74,7 @@ describe('FileInfoService', () => {
});
});
it('Generic JPEG', async () => {
test('Generic JPEG', async () => {
const path = `${resources}/Lenna.jpg`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -94,7 +94,7 @@ describe('FileInfoService', () => {
});
});
it('Generic APNG', async () => {
test('Generic APNG', async () => {
const path = `${resources}/anime.png`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -114,7 +114,7 @@ describe('FileInfoService', () => {
});
});
it('Generic AGIF', async () => {
test('Generic AGIF', async () => {
const path = `${resources}/anime.gif`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -134,7 +134,7 @@ describe('FileInfoService', () => {
});
});
it('PNG with alpha', async () => {
test('PNG with alpha', async () => {
const path = `${resources}/with-alpha.png`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -154,7 +154,7 @@ describe('FileInfoService', () => {
});
});
it('Generic SVG', async () => {
test('Generic SVG', async () => {
const path = `${resources}/image.svg`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -174,7 +174,7 @@ describe('FileInfoService', () => {
});
});
it('SVG with XML definition', async () => {
test('SVG with XML definition', async () => {
// https://github.com/misskey-dev/misskey/issues/4413
const path = `${resources}/with-xml-def.svg`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
@ -195,7 +195,7 @@ describe('FileInfoService', () => {
});
});
it('Dimension limit', async () => {
test('Dimension limit', async () => {
const path = `${resources}/25000x25000.png`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;
@ -215,7 +215,7 @@ describe('FileInfoService', () => {
});
});
it('Rotate JPEG', async () => {
test('Rotate JPEG', async () => {
const path = `${resources}/rotate.jpg`;
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
delete info.warnings;

View file

@ -35,7 +35,7 @@ describe('MetaService', () => {
await app.close();
});
it('fetch (cache)', async () => {
test('fetch (cache)', async () => {
const db = app.get<DataSource>(DI.db);
const spy = jest.spyOn(db, 'transaction');
@ -45,7 +45,7 @@ describe('MetaService', () => {
expect(spy).toHaveBeenCalledTimes(0);
});
it('fetch (force)', async () => {
test('fetch (force)', async () => {
const db = app.get<DataSource>(DI.db);
const spy = jest.spyOn(db, 'transaction');

View file

@ -57,7 +57,7 @@ describe('RelayService', () => {
await app.close();
});
it('addRelay', async () => {
test('addRelay', async () => {
const result = await relayService.addRelay('https://example.com');
expect(result.inbox).toBe('https://example.com');
@ -68,7 +68,7 @@ describe('RelayService', () => {
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
});
it('listRelay', async () => {
test('listRelay', async () => {
const result = await relayService.listRelay();
expect(result.length).toBe(1);
@ -76,7 +76,7 @@ describe('RelayService', () => {
expect(result[0].status).toBe('requesting');
});
it('removeRelay: succ', async () => {
test('removeRelay: succ', async () => {
await relayService.removeRelay('https://example.com');
expect(queueService.deliver).toHaveBeenCalled();
@ -89,7 +89,7 @@ describe('RelayService', () => {
expect(list.length).toBe(0);
});
it('removeRelay: fail', async () => {
test('removeRelay: fail', async () => {
await expect(relayService.removeRelay('https://x.example.com'))
.rejects.toThrow('relay not found');
});

View file

@ -102,7 +102,7 @@ describe('RoleService', () => {
});
describe('getUserPolicies', () => {
it('instance default policies', async () => {
test('instance default policies', async () => {
const user = await createUser();
metaService.fetch.mockResolvedValue({
policies: {
@ -115,7 +115,7 @@ describe('RoleService', () => {
expect(result.canManageCustomEmojis).toBe(false);
});
it('instance default policies 2', async () => {
test('instance default policies 2', async () => {
const user = await createUser();
metaService.fetch.mockResolvedValue({
policies: {
@ -128,7 +128,7 @@ describe('RoleService', () => {
expect(result.canManageCustomEmojis).toBe(true);
});
it('with role', async () => {
test('with role', async () => {
const user = await createUser();
const role = await createRole({
name: 'a',
@ -152,7 +152,7 @@ describe('RoleService', () => {
expect(result.canManageCustomEmojis).toBe(true);
});
it('priority', async () => {
test('priority', async () => {
const user = await createUser();
const role1 = await createRole({
name: 'role1',
@ -187,7 +187,7 @@ describe('RoleService', () => {
expect(result.driveCapacityMb).toBe(100);
});
it('conditional role', async () => {
test('conditional role', async () => {
const user1 = await createUser({
createdAt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 365)),
});

View file

@ -78,7 +78,7 @@ describe('Chart', () => {
if (db) await db.destroy();
});
it('Can updates', async () => {
test('Can updates', async () => {
await testChart.increment();
await testChart.save();
@ -102,7 +102,7 @@ describe('Chart', () => {
});
});
it('Can updates (dec)', async () => {
test('Can updates (dec)', async () => {
await testChart.decrement();
await testChart.save();
@ -126,7 +126,7 @@ describe('Chart', () => {
});
});
it('Empty chart', async () => {
test('Empty chart', async () => {
const chartHours = await testChart.getChart('hour', 3, null);
const chartDays = await testChart.getChart('day', 3, null);
@ -147,7 +147,7 @@ describe('Chart', () => {
});
});
it('Can updates at multiple times at same time', async () => {
test('Can updates at multiple times at same time', async () => {
await testChart.increment();
await testChart.increment();
await testChart.increment();
@ -173,7 +173,7 @@ describe('Chart', () => {
});
});
it('複数回saveされてもデータの更新は一度だけ', async () => {
test('複数回saveされてもデータの更新は一度だけ', async () => {
await testChart.increment();
await testChart.save();
await testChart.save();
@ -199,7 +199,7 @@ describe('Chart', () => {
});
});
it('Can updates at different times', async () => {
test('Can updates at different times', async () => {
await testChart.increment();
await testChart.save();
@ -230,7 +230,7 @@ describe('Chart', () => {
// 仕様上はこうなってほしいけど、実装は難しそうなのでskip
/*
it('Can updates at different times without save', async () => {
test('Can updates at different times without save', async () => {
await testChart.increment();
clock.tick('01:00:00');
@ -259,7 +259,7 @@ describe('Chart', () => {
});
*/
it('Can padding', async () => {
test('Can padding', async () => {
await testChart.increment();
await testChart.save();
@ -289,7 +289,7 @@ describe('Chart', () => {
});
// 要求された範囲にログがひとつもない場合でもパディングできる
it('Can padding from past range', async () => {
test('Can padding from past range', async () => {
await testChart.increment();
await testChart.save();
@ -317,7 +317,7 @@ describe('Chart', () => {
// 要求された範囲の最も古い箇所に位置するログが存在しない場合でもパディングできる
// Issue #3190
it('Can padding from past range 2', async () => {
test('Can padding from past range 2', async () => {
await testChart.increment();
await testChart.save();
@ -346,7 +346,7 @@ describe('Chart', () => {
});
});
it('Can specify offset', async () => {
test('Can specify offset', async () => {
await testChart.increment();
await testChart.save();
@ -375,7 +375,7 @@ describe('Chart', () => {
});
});
it('Can specify offset (floor time)', async () => {
test('Can specify offset (floor time)', async () => {
clock.tick('00:30:00');
await testChart.increment();
@ -407,7 +407,7 @@ describe('Chart', () => {
});
describe('Grouped', () => {
it('Can updates', async () => {
test('Can updates', async () => {
await testGroupedChart.increment('alice');
await testGroupedChart.save();
@ -451,7 +451,7 @@ describe('Chart', () => {
});
describe('Unique increment', () => {
it('Can updates', async () => {
test('Can updates', async () => {
await testUniqueChart.uniqueIncrement('alice');
await testUniqueChart.uniqueIncrement('alice');
await testUniqueChart.uniqueIncrement('bob');
@ -470,7 +470,7 @@ describe('Chart', () => {
});
describe('Intersection', () => {
it('条件が満たされていない場合はカウントされない', async () => {
test('条件が満たされていない場合はカウントされない', async () => {
await testIntersectionChart.addA('alice');
await testIntersectionChart.addA('bob');
await testIntersectionChart.addB('carol');
@ -492,7 +492,7 @@ describe('Chart', () => {
});
});
it('条件が満たされている場合にカウントされる', async () => {
test('条件が満たされている場合にカウントされる', async () => {
await testIntersectionChart.addA('alice');
await testIntersectionChart.addA('bob');
await testIntersectionChart.addB('carol');
@ -518,7 +518,7 @@ describe('Chart', () => {
});
describe('Resync', () => {
it('Can resync', async () => {
test('Can resync', async () => {
testChart.total = 1;
await testChart.resync();
@ -543,7 +543,7 @@ describe('Chart', () => {
});
});
it('Can resync (2)', async () => {
test('Can resync (2)', async () => {
await testChart.increment();
await testChart.save();