From 079425c027e693a2fce40fb70783c66da4952e63 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 27 Feb 2022 14:14:27 +0900 Subject: [PATCH] improve test --- packages/backend/test/endpoints.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/backend/test/endpoints.ts b/packages/backend/test/endpoints.ts index 1331cf77c..2aedc25f2 100644 --- a/packages/backend/test/endpoints.ts +++ b/packages/backend/test/endpoints.ts @@ -223,10 +223,17 @@ describe('API: Endpoints', () => { const alice = await signup({ username: 'alice' }); const res = await request('/notes/reactions/create', { noteId: bobPost.id, - reaction: '๐Ÿ‘', + reaction: '๐Ÿš€', }, alice); assert.strictEqual(res.status, 204); + + const resNote = await request('/notes/show', { + noteId: bobPost.id, + }, alice); + + assert.strictEqual(resNote.status, 200); + assert.strictEqual(resNote.body.reactions['๐Ÿš€'], [alice.id]); })); it('่‡ชๅˆ†ใฎๆŠ•็จฟใซใ‚‚ใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณใงใใ‚‹', async(async () => { @@ -234,7 +241,7 @@ describe('API: Endpoints', () => { const res = await request('/notes/reactions/create', { noteId: myPost.id, - reaction: '๐Ÿ‘', + reaction: '๐Ÿš€', }, alice); assert.strictEqual(res.status, 204); @@ -247,7 +254,7 @@ describe('API: Endpoints', () => { const res = await request('/notes/reactions/create', { noteId: bobPost.id, - reaction: '๐Ÿ‘', + reaction: '๐Ÿš€', }, alice); assert.strictEqual(res.status, 400); @@ -256,7 +263,7 @@ describe('API: Endpoints', () => { it('ๅญ˜ๅœจใ—ใชใ„ๆŠ•็จฟใซใฏใƒชใ‚ขใ‚ฏใ‚ทใƒงใƒณใงใใชใ„', async(async () => { const res = await request('/notes/reactions/create', { noteId: '000000000000000000000000', - reaction: '๐Ÿ‘', + reaction: '๐Ÿš€', }, alice); assert.strictEqual(res.status, 400); @@ -271,7 +278,7 @@ describe('API: Endpoints', () => { it('้–“้•ใฃใŸIDใงๆ€’ใ‚‰ใ‚Œใ‚‹', async(async () => { const res = await request('/notes/reactions/create', { noteId: 'kyoppie', - reaction: '๐Ÿ‘', + reaction: '๐Ÿš€', }, alice); assert.strictEqual(res.status, 400);