From 1c5e04199e07cfe5934f7122f43a0064c7926c32 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Fri, 21 Jun 2024 03:47:26 +0900 Subject: [PATCH] =?UTF-8?q?use=20optional=20chain=20to=20kill=20TS2532=20o?= =?UTF-8?q?n=20timeline=20test=20=E5=A4=89=E6=9B=B4=E5=89=8D:=20=E8=A9=B2?= =?UTF-8?q?=E5=BD=93=E3=83=8E=E3=83=BC=E3=83=88=E3=81=8C=E8=A6=8B=E3=81=A4?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=81=AA=E3=81=91=E3=82=8C=E3=81=B0undefined?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E3=81=99=E3=82=8B=E3=83=97=E3=83=AD=E3=83=91?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E3=81=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=83=86=E3=82=B9=E3=83=88=E3=81=8C=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=83=83=E3=82=B7=E3=83=A5=20=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E5=BE=8C:=20=E8=A9=B2=E5=BD=93=E3=83=8E=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=8C=E8=A6=8B=E3=81=A4=E3=81=8B=E3=82=89=E3=81=AA=E3=81=91?= =?UTF-8?q?=E3=82=8C=E3=81=B0optional=20chain=E3=81=8Cundefined=E3=81=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E8=A9=95=E4=BE=A1=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=81=8C=E3=80=81strictEqual=E3=81=AE=E5=8F=B3=E8=BE=BA?= =?UTF-8?q?=E3=81=8Cnon-nullable=E3=81=AA=E3=81=9F=E3=82=81=E3=82=A2?= =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=AB=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=97=E3=83=86=E3=82=B9=E3=83=88=E3=81=8C=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=83=83=E3=82=B7=E3=83=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/test/e2e/timelines.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/backend/test/e2e/timelines.ts b/packages/backend/test/e2e/timelines.ts index 11b81fac7d..b09f37375d 100644 --- a/packages/backend/test/e2e/timelines.ts +++ b/packages/backend/test/e2e/timelines.ts @@ -29,7 +29,7 @@ describe('Timelines', () => { const res = await api('notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true); - assert.strictEqual(res.body.find(note => note.id === aliceNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi'); }); test.concurrent('フォローしているユーザーのノートが含まれる', async () => { @@ -61,7 +61,7 @@ describe('Timelines', () => { const res = await api('notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); - assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi'); assert.strictEqual(res.body.some(note => note.id === carolNote.id), false); }); @@ -149,7 +149,7 @@ describe('Timelines', () => { assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); assert.strictEqual(res.body.some(note => note.id === carolNote.id), true); - assert.strictEqual(res.body.find(note => note.id === carolNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === carolNote.id)?.text, 'hi'); }); test.concurrent('withReplies: true でフォローしているユーザーの行った別のフォローしているユーザーの投稿への visibility: specified な返信が含まれない', async () => { @@ -396,7 +396,7 @@ describe('Timelines', () => { const res = await api('notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true); - assert.strictEqual(res.body.find(note => note.id === aliceNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi'); }); test.concurrent('フォローしているユーザーの自身を visibleUserIds に指定した visibility: specified なノートが含まれる', async () => { @@ -411,7 +411,7 @@ describe('Timelines', () => { const res = await api('notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); - assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi'); }); test.concurrent('フォローしていないユーザーの自身を visibleUserIds に指定した visibility: specified なノートが含まれない', async () => { @@ -451,7 +451,7 @@ describe('Timelines', () => { const res = await api('notes/timeline', { limit: 100 }, alice); assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true); - assert.strictEqual(res.body.find(note => note.id === aliceNote.id).text, 'ok'); + assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'ok'); }); /* TODO @@ -966,7 +966,7 @@ describe('Timelines', () => { const res = await api('notes/user-list-timeline', { listId: list.id }, alice); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); - assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi'); }); test.concurrent('リスインしている自分の visibility: followers なノートが含まれる', async () => { @@ -982,7 +982,7 @@ describe('Timelines', () => { const res = await api('notes/user-list-timeline', { listId: list.id }, alice); assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true); - assert.strictEqual(res.body.find(note => note.id === aliceNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi'); }); test.concurrent('リスインしているユーザーのチャンネルノートが含まれない', async () => { @@ -1031,7 +1031,7 @@ describe('Timelines', () => { const res = await api('notes/user-list-timeline', { listId: list.id }, alice); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); - assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi'); }); test.concurrent('リスインしているユーザーの自身宛てではない visibility: specified なノートが含まれない', async () => { @@ -1088,7 +1088,7 @@ describe('Timelines', () => { const res = await api('users/notes', { userId: bob.id }, alice); assert.strictEqual(res.body.some(note => note.id === bobNote.id), true); - assert.strictEqual(res.body.find(note => note.id === bobNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === bobNote.id)?.text, 'hi'); }); test.concurrent('自身の visibility: followers なノートが含まれる', async () => { @@ -1101,7 +1101,7 @@ describe('Timelines', () => { const res = await api('users/notes', { userId: alice.id }, alice); assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true); - assert.strictEqual(res.body.find(note => note.id === aliceNote.id).text, 'hi'); + assert.strictEqual(res.body.find(note => note.id === aliceNote.id)?.text, 'hi'); }); test.concurrent('チャンネル投稿が含まれない', async () => {