mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-14 10:05:46 +01:00
test(backend): goodbye, Lenna (#14111)
This commit is contained in:
parent
427648c4b8
commit
eafae79869
13 changed files with 18 additions and 18 deletions
|
@ -20,7 +20,7 @@ export const packedDriveFileSchema = {
|
||||||
name: {
|
name: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
example: 'lenna.jpg',
|
example: '192.jpg',
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const meta = {
|
||||||
name: {
|
name: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
example: 'lenna.jpg',
|
example: '192.jpg',
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('Drive', () => {
|
||||||
|
|
||||||
const marker = Math.random().toString();
|
const marker = Math.random().toString();
|
||||||
|
|
||||||
const url = 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg';
|
const url = 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/192.jpg';
|
||||||
|
|
||||||
const catcher = makeStreamCatcher(
|
const catcher = makeStreamCatcher(
|
||||||
alice,
|
alice,
|
||||||
|
@ -41,14 +41,14 @@ describe('Drive', () => {
|
||||||
const file = await catcher;
|
const file = await catcher;
|
||||||
|
|
||||||
assert.strictEqual(res.status, 204);
|
assert.strictEqual(res.status, 204);
|
||||||
assert.strictEqual(file.name, 'Lenna.jpg');
|
assert.strictEqual(file.name, '192.jpg');
|
||||||
assert.strictEqual(file.type, 'image/jpeg');
|
assert.strictEqual(file.type, 'image/jpeg');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ローカルからアップロードできる', async () => {
|
test('ローカルからアップロードできる', async () => {
|
||||||
// APIレスポンスを直接使用するので utils.js uploadFile が通過することで成功とする
|
// APIレスポンスを直接使用するので utils.js uploadFile が通過することで成功とする
|
||||||
|
|
||||||
const res = await uploadFile(alice, { path: 'Lenna.jpg', name: 'テスト画像' });
|
const res = await uploadFile(alice, { path: '192.jpg', name: 'テスト画像' });
|
||||||
|
|
||||||
assert.strictEqual(res.body?.name, 'テスト画像.jpg');
|
assert.strictEqual(res.body?.name, 'テスト画像.jpg');
|
||||||
assert.strictEqual(res.body.type, 'image/jpeg');
|
assert.strictEqual(res.body.type, 'image/jpeg');
|
||||||
|
|
|
@ -584,7 +584,7 @@ describe('Endpoints', () => {
|
||||||
|
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true);
|
assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true);
|
||||||
assert.strictEqual(res.body!.name, 'Lenna.jpg');
|
assert.strictEqual(res.body!.name, '192.jpg');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ファイルに名前を付けられる', async () => {
|
test('ファイルに名前を付けられる', async () => {
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe('Note', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ファイルを添付できる', async () => {
|
test('ファイルを添付できる', async () => {
|
||||||
const file = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
const file = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/192.jpg');
|
||||||
|
|
||||||
const res = await api('notes/create', {
|
const res = await api('notes/create', {
|
||||||
fileIds: [file.id],
|
fileIds: [file.id],
|
||||||
|
@ -53,7 +53,7 @@ describe('Note', () => {
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
|
|
||||||
test('他人のファイルで怒られる', async () => {
|
test('他人のファイルで怒られる', async () => {
|
||||||
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/192.jpg');
|
||||||
|
|
||||||
const res = await api('notes/create', {
|
const res = await api('notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
|
|
|
@ -17,8 +17,8 @@ describe('users/notes', () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
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/192.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/192.png');
|
||||||
jpgNote = await post(alice, {
|
jpgNote = await post(alice, {
|
||||||
fileIds: [jpg.id],
|
fileIds: [jpg.id],
|
||||||
});
|
});
|
||||||
|
|
BIN
packages/backend/test/resources/192.jpg
Normal file
BIN
packages/backend/test/resources/192.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5 KiB |
BIN
packages/backend/test/resources/192.png
Normal file
BIN
packages/backend/test/resources/192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
Before Width: | Height: | Size: 463 KiB |
|
@ -83,21 +83,21 @@ describe('FileInfoService', () => {
|
||||||
|
|
||||||
describe('IMAGE', () => {
|
describe('IMAGE', () => {
|
||||||
test('Generic JPEG', async () => {
|
test('Generic JPEG', async () => {
|
||||||
const path = `${resources}/Lenna.jpg`;
|
const path = `${resources}/192.jpg`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
delete info.blurhash;
|
delete info.blurhash;
|
||||||
delete info.sensitive;
|
delete info.sensitive;
|
||||||
delete info.porn;
|
delete info.porn;
|
||||||
assert.deepStrictEqual(info, {
|
assert.deepStrictEqual(info, {
|
||||||
size: 25360,
|
size: 5131,
|
||||||
md5: '091b3f259662aa31e2ffef4519951168',
|
md5: '8c9ed0677dd2b8f9f7472c3af247e5e3',
|
||||||
type: {
|
type: {
|
||||||
mime: 'image/jpeg',
|
mime: 'image/jpeg',
|
||||||
ext: 'jpg',
|
ext: 'jpg',
|
||||||
},
|
},
|
||||||
width: 512,
|
width: 192,
|
||||||
height: 512,
|
height: 192,
|
||||||
orientation: undefined,
|
orientation: undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -297,7 +297,7 @@ export const uploadFile = async (user?: UserToken, { path, name, blob }: UploadO
|
||||||
body: misskey.entities.DriveFile | null
|
body: misskey.entities.DriveFile | null
|
||||||
}> => {
|
}> => {
|
||||||
const absPath = path == null
|
const absPath = path == null
|
||||||
? new URL('resources/Lenna.jpg', import.meta.url)
|
? new URL('resources/192.jpg', import.meta.url)
|
||||||
: isAbsolute(path.toString())
|
: isAbsolute(path.toString())
|
||||||
? new URL(path)
|
? new URL(path)
|
||||||
: new URL(path, new URL('resources/', import.meta.url));
|
: new URL(path, new URL('resources/', import.meta.url));
|
||||||
|
|
|
@ -4299,7 +4299,7 @@ export type components = {
|
||||||
id: string;
|
id: string;
|
||||||
/** Format: date-time */
|
/** Format: date-time */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** @example lenna.jpg */
|
/** @example 192.jpg */
|
||||||
name: string;
|
name: string;
|
||||||
/** @example image/jpeg */
|
/** @example image/jpeg */
|
||||||
type: string;
|
type: string;
|
||||||
|
@ -6799,7 +6799,7 @@ export type operations = {
|
||||||
* @example 15eca7fba0480996e2245f5185bf39f2
|
* @example 15eca7fba0480996e2245f5185bf39f2
|
||||||
*/
|
*/
|
||||||
md5: string;
|
md5: string;
|
||||||
/** @example lenna.jpg */
|
/** @example 192.jpg */
|
||||||
name: string;
|
name: string;
|
||||||
/** @example image/jpeg */
|
/** @example image/jpeg */
|
||||||
type: string;
|
type: string;
|
||||||
|
|
Loading…
Reference in a new issue