mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-22 22:13:09 +02:00
fix backend tests
This commit is contained in:
parent
1cae3bfa3b
commit
69697dd9f7
2 changed files with 4 additions and 6 deletions
|
@ -529,14 +529,14 @@ describe('ユーザー', () => {
|
||||||
|
|
||||||
test('を書き換えることができる(Background)', async () => {
|
test('を書き換えることができる(Background)', async () => {
|
||||||
const aliceFile = (await uploadFile(alice)).body;
|
const aliceFile = (await uploadFile(alice)).body;
|
||||||
const parameters = { bannerId: aliceFile.id };
|
const parameters = { bannerId: aliceFile!.id };
|
||||||
const response = await successfulApiCall({ endpoint: 'i/update', parameters: parameters, user: alice });
|
const response = await successfulApiCall({ endpoint: 'i/update', parameters: parameters, user: alice });
|
||||||
assert.match(response.backgroundUrl ?? '.', /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/);
|
assert.match(response.backgroundUrl ?? '.', /^[-a-zA-Z0-9@:%._\+~#&?=\/]+$/);
|
||||||
assert.match(response.backgroundBlurhash ?? '.', /[ -~]{54}/);
|
assert.match(response.backgroundBlurhash ?? '.', /[ -~]{54}/);
|
||||||
const expected = {
|
const expected = {
|
||||||
...meDetailed(alice, true),
|
...meDetailed(alice, true),
|
||||||
backgroundId: aliceFile.id,
|
backgroundId: aliceFile!.id,
|
||||||
backgroundBlurhash: response.baackgroundBlurhash,
|
backgroundBlurhash: response.backgroundBlurhash,
|
||||||
backgroundUrl: response.backgroundUrl,
|
backgroundUrl: response.backgroundUrl,
|
||||||
};
|
};
|
||||||
assert.deepStrictEqual(response, expected, inspect(parameters));
|
assert.deepStrictEqual(response, expected, inspect(parameters));
|
||||||
|
@ -639,10 +639,8 @@ describe('ユーザー', () => {
|
||||||
});
|
});
|
||||||
test.each([
|
test.each([
|
||||||
{ label: 'Administratorになっている', user: () => userAdmin, me: () => userAdmin, selector: (user: misskey.entities.MeDetailed) => user.isAdmin },
|
{ label: 'Administratorになっている', user: () => userAdmin, me: () => userAdmin, selector: (user: misskey.entities.MeDetailed) => user.isAdmin },
|
||||||
// @ts-expect-error UserDetailedNotMe doesn't include isAdmin
|
|
||||||
{ label: '自分以外から見たときはAdministratorか判定できない', user: () => userAdmin, selector: (user: misskey.entities.UserDetailedNotMe) => user.isAdmin, expected: () => undefined },
|
{ label: '自分以外から見たときはAdministratorか判定できない', user: () => userAdmin, selector: (user: misskey.entities.UserDetailedNotMe) => user.isAdmin, expected: () => undefined },
|
||||||
{ label: 'Moderatorになっている', user: () => userModerator, me: () => userModerator, selector: (user: misskey.entities.MeDetailed) => user.isModerator },
|
{ label: 'Moderatorになっている', user: () => userModerator, me: () => userModerator, selector: (user: misskey.entities.MeDetailed) => user.isModerator },
|
||||||
// @ts-expect-error UserDetailedNotMe doesn't include isModerator
|
|
||||||
{ label: '自分以外から見たときはModeratorか判定できない', user: () => userModerator, selector: (user: misskey.entities.UserDetailedNotMe) => user.isModerator, expected: () => undefined },
|
{ label: '自分以外から見たときはModeratorか判定できない', user: () => userModerator, selector: (user: misskey.entities.UserDetailedNotMe) => user.isModerator, expected: () => undefined },
|
||||||
{ label: 'サイレンスになっている', user: () => userSilenced, selector: (user: misskey.entities.UserDetailed) => user.isSilenced },
|
{ label: 'サイレンスになっている', user: () => userSilenced, selector: (user: misskey.entities.UserDetailed) => user.isSilenced },
|
||||||
// FIXME: 落ちる
|
// FIXME: 落ちる
|
||||||
|
|
|
@ -322,7 +322,7 @@ describe('FileInfoService', () => {
|
||||||
|
|
||||||
test('MPEG-4 AUDIO (M4A)', async () => {
|
test('MPEG-4 AUDIO (M4A)', async () => {
|
||||||
const path = `${resources}/kick_gaba7.m4a`;
|
const path = `${resources}/kick_gaba7.m4a`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
delete info.blurhash;
|
delete info.blurhash;
|
||||||
delete info.sensitive;
|
delete info.sensitive;
|
||||||
|
|
Loading…
Reference in a new issue