diff --git a/packages/backend/test/api-visibility.ts b/packages/backend/test/api-visibility.ts index cde3cd2d0..3e453f8ee 100644 --- a/packages/backend/test/api-visibility.ts +++ b/packages/backend/test/api-visibility.ts @@ -17,15 +17,15 @@ describe('API visibility', () => { describe('Note visibility', async () => { //#region vars - /** ヒロイン */ + /** protagonist */ let alice: any; - /** フォロワー */ + /** follower */ let follower: any; - /** 非フォロワー */ + /** non-follower */ let other: any; - /** 非フォロワーでもリプライやメンションをされた人 */ + /** non-follower who has been replied to or mentioned */ let target: any; - /** specified mentionでmentionを飛ばされる人 */ + /** actor for which a specified visibility was set */ let target2: any; /** public-post */ @@ -100,90 +100,90 @@ describe('API visibility', () => { //#region show post // public - it('[show] public-postを自分が見れる', async(async () => { + it('[show] public post can be seen by author', async(async () => { const res = await show(pub.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-postをフォロワーが見れる', async(async () => { + it('[show] public post can be seen by follower', async(async () => { const res = await show(pub.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-postを非フォロワーが見れる', async(async () => { + it('[show] public post can be seen by non-follower', async(async () => { const res = await show(pub.id, other); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-postを未認証が見れる', async(async () => { + it('[show] public post can be seen unauthenticated', async(async () => { const res = await show(pub.id, null); assert.strictEqual(res.body.text, 'x'); })); // home - it('[show] home-postを自分が見れる', async(async () => { + it('[show] home post can be seen by author', async(async () => { const res = await show(home.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-postをフォロワーが見れる', async(async () => { + it('[show] home post can be seen by follower', async(async () => { const res = await show(home.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-postを非フォロワーが見れる', async(async () => { + it('[show] home post can be seen by non-follower', async(async () => { const res = await show(home.id, other); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-postを未認証が見れる', async(async () => { + it('[show] home post can be seen unauthenticated', async(async () => { const res = await show(home.id, null); assert.strictEqual(res.body.text, 'x'); })); // followers - it('[show] followers-postを自分が見れる', async(async () => { + it('[show] followers post can be seen by author', async(async () => { const res = await show(fol.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] followers-postをフォロワーが見れる', async(async () => { + it('[show] followers post can be seen by follower', async(async () => { const res = await show(fol.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] followers-postを非フォロワーが見れない', async(async () => { + it('[show] followers post is hidden from non-follower', async(async () => { const res = await show(fol.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-postを未認証が見れない', async(async () => { + it('[show] followers post is hidden when unathenticated', async(async () => { const res = await show(fol.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-postを自分が見れる', async(async () => { + it('[show] specified post can be seen by author', async(async () => { const res = await show(spe.id, alice); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを指定ユーザーが見れる', async(async () => { + it('[show] specified post can be seen by designated user', async(async () => { const res = await show(spe.id, target); assert.strictEqual(res.body.text, 'x'); })); - it('[show] specified-postをフォロワーが見れない', async(async () => { + it('[show] specified post is hidden from non-specified follower', async(async () => { const res = await show(spe.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを非フォロワーが見れない', async(async () => { + it('[show] specified post is hidden from non-follower', async(async () => { const res = await show(spe.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-postを未認証が見れない', async(async () => { + it('[show] specified post is hidden when unauthenticated', async(async () => { const res = await show(spe.id, null); assert.strictEqual(res.status, 404); })); @@ -191,90 +191,90 @@ describe('API visibility', () => { //#region show reply // public - it('[show] public-replyを自分が見れる', async(async () => { + it('[show] public reply can be seen by author', async(async () => { const res = await show(pubR.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-replyをされた人が見れる', async(async () => { + it('[show] public reply can be seen by replied to author', async(async () => { const res = await show(pubR.id, target); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-replyをフォロワーが見れる', async(async () => { + it('[show] public reply can be seen by follower', async(async () => { const res = await show(pubR.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-replyを非フォロワーが見れる', async(async () => { + it('[show] public reply can be seen by non-follower', async(async () => { const res = await show(pubR.id, other); assert.strictEqual(res.body.text, 'x'); })); - it('[show] public-replyを未認証が見れる', async(async () => { + it('[show] public reply can be seen unauthenticated', async(async () => { const res = await show(pubR.id, null); assert.strictEqual(res.body.text, 'x'); })); // home - it('[show] home-replyを自分が見れる', async(async () => { + it('[show] home reply can be seen by author', async(async () => { const res = await show(homeR.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-replyをされた人が見れる', async(async () => { + it('[show] home reply can be seen by replied to author', async(async () => { const res = await show(homeR.id, target); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-replyをフォロワーが見れる', async(async () => { + it('[show] home reply can be seen by follower', async(async () => { const res = await show(homeR.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-replyを非フォロワーが見れる', async(async () => { + it('[show] home reply can be seen by non-follower', async(async () => { const res = await show(homeR.id, other); assert.strictEqual(res.body.text, 'x'); })); - it('[show] home-replyを未認証が見れる', async(async () => { + it('[show] home reply can be seen unauthenticated', async(async () => { const res = await show(homeR.id, null); assert.strictEqual(res.body.text, 'x'); })); // followers - it('[show] followers-replyを自分が見れる', async(async () => { + it('[show] followers reply can be seen by author', async(async () => { const res = await show(folR.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async(async () => { + it('[show] followers reply can be seen by replied to author', async(async () => { const res = await show(folR.id, target); assert.strictEqual(res.body.text, 'x'); })); - it('[show] followers-replyをフォロワーが見れる', async(async () => { + it('[show] followers reply can be seen by follower', async(async () => { const res = await show(folR.id, follower); assert.strictEqual(res.body.text, 'x'); })); - it('[show] followers-replyを非フォロワーが見れない', async(async () => { + it('[show] followers reply is hidden from non-follower', async(async () => { const res = await show(folR.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-replyを未認証が見れない', async(async () => { + it('[show] followers reply is hidden when unauthenticated', async(async () => { const res = await show(folR.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-replyを自分が見れる', async(async () => { + it('[show] specified reply can be seen by author', async(async () => { const res = await show(speR.id, alice); assert.strictEqual(res.body.text, 'x'); })); - it('[show] specified-replyを指定ユーザーが見れる', async(async () => { + it('[show] specified reply can be seen by replied to user', async(async () => { const res = await show(speR.id, target); assert.strictEqual(res.body.text, 'x'); })); @@ -284,17 +284,17 @@ describe('API visibility', () => { assert.strictEqual(res.body.text, 'x'); })); - it('[show] specified-replyをフォロワーが見れない', async(async () => { + it('[show] specified reply is hidden from follower', async(async () => { const res = await show(speR.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-replyを非フォロワーが見れない', async(async () => { + it('[show] specified reply is hidden from non-follower', async(async () => { const res = await show(speR.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-replyを未認証が見れない', async(async () => { + it('[show] specified reply is hidden when unauthenticated', async(async () => { const res = await show(speR.id, null); assert.strictEqual(res.status, 404); })); @@ -302,131 +302,131 @@ describe('API visibility', () => { //#region show mention // public - it('[show] public-mentionを自分が見れる', async(async () => { + it('[show] public-mention can be seen by author', async(async () => { const res = await show(pubM.id, alice); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] public-mentionをされた人が見れる', async(async () => { + it('[show] public mention can be seen by mentioned', async(async () => { const res = await show(pubM.id, target); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] public-mentionをフォロワーが見れる', async(async () => { + it('[show] public mention can be seen by follower', async(async () => { const res = await show(pubM.id, follower); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] public-mentionを非フォロワーが見れる', async(async () => { + it('[show] public mention can be seen by non-follower', async(async () => { const res = await show(pubM.id, other); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] public-mentionを未認証が見れる', async(async () => { + it('[show] public mention can be seen unauthenticated', async(async () => { const res = await show(pubM.id, null); assert.strictEqual(res.body.text, '@target x'); })); // home - it('[show] home-mentionを自分が見れる', async(async () => { + it('[show] home mention can be seen by author', async(async () => { const res = await show(homeM.id, alice); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] home-mentionをされた人が見れる', async(async () => { + it('[show] home mention can be seen by mentioned', async(async () => { const res = await show(homeM.id, target); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] home-mentionをフォロワーが見れる', async(async () => { + it('[show] home mention can be seen by follower', async(async () => { const res = await show(homeM.id, follower); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] home-mentionを非フォロワーが見れる', async(async () => { + it('[show] home mention can be seen by non-follower', async(async () => { const res = await show(homeM.id, other); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] home-mentionを未認証が見れる', async(async () => { + it('[show] home mention can be seen unauthenticated', async(async () => { const res = await show(homeM.id, null); assert.strictEqual(res.body.text, '@target x'); })); // followers - it('[show] followers-mentionを自分が見れる', async(async () => { + it('[show] followers mention can be seen by author', async(async () => { const res = await show(folM.id, alice); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async(async () => { + it('[show] followers mention can be seen by non-follower mentioned', async(async () => { const res = await show(folM.id, target); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] followers-mentionをフォロワーが見れる', async(async () => { + it('[show] followers mention can be seen by follower', async(async () => { const res = await show(folM.id, follower); assert.strictEqual(res.body.text, '@target x'); })); - it('[show] followers-mentionを非フォロワーが見れない', async(async () => { + it('[show] followers mention is hidden from non-follower', async(async () => { const res = await show(folM.id, other); assert.strictEqual(res.status, 404); })); - it('[show] followers-mentionを未認証が見れない', async(async () => { + it('[show] followers mention is hidden when unauthenticated', async(async () => { const res = await show(folM.id, null); assert.strictEqual(res.status, 404); })); // specified - it('[show] specified-mentionを自分が見れる', async(async () => { + it('[show] specified mention can be seen by author', async(async () => { const res = await show(speM.id, alice); assert.strictEqual(res.body.text, '@target2 x'); })); - it('[show] specified-mentionを指定ユーザーが見れる', async(async () => { + it('[show] specified mention can be seen by specified actor', async(async () => { const res = await show(speM.id, target); assert.strictEqual(res.body.text, '@target2 x'); })); - it('[show] specified-mentionをされた人が指定されてなかったら見れない', async(async () => { + it('[show] specified mention is hidden from mentioned but not specified actor', async(async () => { const res = await show(speM.id, target2); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionをフォロワーが見れない', async(async () => { + it('[show] specified mention is hidden from follower', async(async () => { const res = await show(speM.id, follower); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionを非フォロワーが見れない', async(async () => { + it('[show] specified mention is hidden from non-follower', async(async () => { const res = await show(speM.id, other); assert.strictEqual(res.status, 404); })); - it('[show] specified-mentionを未認証が見れない', async(async () => { + it('[show] specified mention is hidden when unauthenticated', async(async () => { const res = await show(speM.id, null); assert.strictEqual(res.status, 404); })); //#endregion - //#region HTL - it('[HTL] public-post が 自分が見れる', async(async () => { + //#region Home Timeline + it('[TL] public post on author home TL', async(async () => { const res = await request('/notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == pub.id); assert.strictEqual(notes[0].text, 'x'); })); - it('[HTL] public-post が 非フォロワーから見れない', async(async () => { + it('[TL] public post absent from non-follower home TL', async(async () => { const res = await request('/notes/timeline', { limit: 100 }, other); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == pub.id); assert.strictEqual(notes.length, 0); })); - it('[HTL] followers-post が フォロワーから見れる', async(async () => { + it('[TL] followers post on follower home TL', async(async () => { const res = await request('/notes/timeline', { limit: 100 }, follower); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == fol.id); @@ -434,22 +434,22 @@ describe('API visibility', () => { })); //#endregion - //#region RTL - it('[replies] followers-reply が フォロワーから見れる', async(async () => { + //#region replies timeline + it('[TL] followers reply on follower reply TL', async(async () => { const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, follower); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); assert.strictEqual(notes[0].text, 'x'); })); - it('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async(async () => { + it('[TL] followers reply absent from not replied to non-follower reply TL', async(async () => { const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, other); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); assert.strictEqual(notes.length, 0); })); - it('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => { + it('[TL] followers reply on replied to actor reply TL', async(async () => { const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, target); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); @@ -458,14 +458,14 @@ describe('API visibility', () => { //#endregion //#region MTL - it('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => { + it('[TL] followers reply on replied to non-follower mention TL', async(async () => { const res = await request('/notes/mentions', { limit: 100 }, target); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folR.id); assert.strictEqual(notes[0].text, 'x'); })); - it('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async(async () => { + it('[TL] followers mention on mentioned non-follower mention TL', async(async () => { const res = await request('/notes/mentions', { limit: 100 }, target); assert.strictEqual(res.status, 200); const notes = res.body.filter((n: any) => n.id == folM.id); diff --git a/packages/backend/test/block.ts b/packages/backend/test/block.ts index c35999d5c..2bcfbcb6e 100644 --- a/packages/backend/test/block.ts +++ b/packages/backend/test/block.ts @@ -23,7 +23,7 @@ describe('Block', () => { await shutdownServer(p); }); - it('Block作成', async(async () => { + it('can block someone', async(async () => { const res = await request('/blocking/create', { userId: bob.id, }, alice); @@ -31,14 +31,14 @@ describe('Block', () => { assert.strictEqual(res.status, 200); })); - it('ブロックされているユーザーをフォローできない', async(async () => { + it('cannot follow if blocked', async(async () => { const res = await request('/following/create', { userId: alice.id }, bob); assert.strictEqual(res.status, 400); assert.strictEqual(res.body.error.code, 'BLOCKED'); })); - it('ブロックされているユーザーにリアクションできない', async(async () => { + it('cannot react to blocking users note', async(async () => { const note = await post(alice, { text: 'hello' }); const res = await request('/notes/reactions/create', { noteId: note.id, reaction: '👍' }, bob); @@ -47,7 +47,7 @@ describe('Block', () => { assert.strictEqual(res.body.error.code, 'BLOCKED'); })); - it('ブロックされているユーザーに返信できない', async(async () => { + it('cannot reply to blocking users note', async(async () => { const note = await post(alice, { text: 'hello' }); const res = await request('/notes/create', { replyId: note.id, text: 'yo' }, bob); @@ -56,7 +56,7 @@ describe('Block', () => { assert.strictEqual(res.body.error.code, 'BLOCKED'); })); - it('ブロックされているユーザーのノートをRenoteできない', async(async () => { + it('canot renote blocking users note', async(async () => { const note = await post(alice, { text: 'hello' }); const res = await request('/notes/create', { renoteId: note.id, text: 'yo' }, bob); @@ -65,11 +65,11 @@ describe('Block', () => { assert.strictEqual(res.body.error.code, 'BLOCKED'); })); - // TODO: ユーザーリストに入れられないテスト + // TODO: test that blocked user cannot be included in user list - // TODO: ユーザーリストから除外されるテスト + // TODO: test that blocked user is removed from user list - it('タイムライン(LTL)にブロックされているユーザーの投稿が含まれない', async(async () => { + it('local timeline does not contain blocked users', async(async () => { const aliceNote = await post(alice); const bobNote = await post(bob); const carolNote = await post(carol);