From 8be78e8da628f2f3269d0f2fd1ef6d0d73814673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Thu, 30 May 2024 13:01:44 +0900 Subject: [PATCH] fix: test case --- packages/backend/test/e2e/reversi-game.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend/test/e2e/reversi-game.ts b/packages/backend/test/e2e/reversi-game.ts index d9a3de94a1..9f264b7045 100644 --- a/packages/backend/test/e2e/reversi-game.ts +++ b/packages/backend/test/e2e/reversi-game.ts @@ -19,10 +19,15 @@ describe('ReversiGame', () => { bob = await signup({ username: 'bob' }); }, 1000 * 60 * 2); - test('matches when alice invites bob', async () => { - const response: { body: ReversiMatchResponse } = await api('reversi/match', { userId: bob.id }, alice); - - assert.strictEqual(response.body.user1.id, alice.id); - assert.strictEqual(response.body.user2.id, bob.id); + test('matches when alice invites bob and bob accepts', async () => { + const response1 = await api('reversi/match', { userId: bob.id }, alice); + assert.strictEqual(response1.status, 200); + assert.strictEqual(response1.body, null); + const response2 = await api('reversi/match', { userId: alice.id }, bob); + assert.strictEqual(response2.status, 200); + assert.notStrictEqual(response2.body, null); + const body = response2.body as ReversiMatchResponse; + assert.strictEqual(body.user1.id, alice.id); + assert.strictEqual(body.user2.id, bob.id); }); });