summaryrefslogtreecommitdiff
path: root/packages/backend/test/e2e/drive.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/test/e2e/drive.ts')
-rw-r--r--packages/backend/test/e2e/drive.ts30
1 files changed, 14 insertions, 16 deletions
diff --git a/packages/backend/test/e2e/drive.ts b/packages/backend/test/e2e/drive.ts
index 3a84961fc7..acffbcd4fc 100644
--- a/packages/backend/test/e2e/drive.ts
+++ b/packages/backend/test/e2e/drive.ts
@@ -1,5 +1,5 @@
/*
- * SPDX-FileCopyrightText: syuilo and other misskey contributors
+ * SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@@ -7,11 +7,10 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import { MiNote } from '@/models/Note.js';
+import type { Packed } from '@/misc/json-schema.js';
import { api, initTestDb, makeStreamCatcher, post, signup, uploadFile } from '../utils.js';
import type * as misskey from 'misskey-js';
-import type{ Repository } from 'typeorm'
-import type { Packed } from '@/misc/json-schema.js';
-
+import type{ Repository } from 'typeorm';
describe('Drive', () => {
let Notes: Repository<MiNote>;
@@ -31,7 +30,7 @@ describe('Drive', () => {
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/Lenna.jpg';
const catcher = makeStreamCatcher(
alice,
@@ -51,7 +50,7 @@ describe('Drive', () => {
assert.strictEqual(res.status, 204);
assert.strictEqual(file.name, 'Lenna.jpg');
assert.strictEqual(file.type, 'image/jpeg');
- })
+ });
test('ローカルからアップロードできる', async () => {
// APIレスポンスを直接使用するので utils.js uploadFile が通過することで成功とする
@@ -59,27 +58,27 @@ describe('Drive', () => {
const res = await uploadFile(alice, { path: 'Lenna.jpg', name: 'テスト画像' });
assert.strictEqual(res.body?.name, 'テスト画像.jpg');
- assert.strictEqual(res.body?.type, 'image/jpeg');
- })
+ assert.strictEqual(res.body.type, 'image/jpeg');
+ });
test('添付ノート一覧を取得できる', async () => {
- const ids = (await Promise.all([uploadFile(alice), uploadFile(alice), uploadFile(alice)])).map(elm => elm.body!.id)
+ const ids = (await Promise.all([uploadFile(alice), uploadFile(alice), uploadFile(alice)])).map(elm => elm.body!.id);
const note0 = await post(alice, { fileIds: [ids[0]] });
const note1 = await post(alice, { fileIds: [ids[0], ids[1]] });
const attached0 = await api('drive/files/attached-notes', { fileId: ids[0] }, alice);
assert.strictEqual(attached0.body.length, 2);
- assert.strictEqual(attached0.body[0].id, note1.id)
- assert.strictEqual(attached0.body[1].id, note0.id)
+ assert.strictEqual(attached0.body[0].id, note1.id);
+ assert.strictEqual(attached0.body[1].id, note0.id);
const attached1 = await api('drive/files/attached-notes', { fileId: ids[1] }, alice);
assert.strictEqual(attached1.body.length, 1);
- assert.strictEqual(attached1.body[0].id, note1.id)
+ assert.strictEqual(attached1.body[0].id, note1.id);
const attached2 = await api('drive/files/attached-notes', { fileId: ids[2] }, alice);
- assert.strictEqual(attached2.body.length, 0)
- })
+ assert.strictEqual(attached2.body.length, 0);
+ });
test('添付ノート一覧は他の人から見えない', async () => {
const file = await uploadFile(alice);
@@ -89,7 +88,6 @@ describe('Drive', () => {
const res = await api('drive/files/attached-notes', { fileId: file.body!.id }, bob);
assert.strictEqual(res.status, 400);
assert.strictEqual('error' in res.body, true);
-
- })
+ });
});