From 8814436d8e2eee57b0ec39b9accc7e071c092398 Mon Sep 17 00:00:00 2001 From: Danya Date: Wed, 1 Nov 2023 12:42:52 +0300 Subject: [PATCH] add real data in expectedAuthReply --- openapi.yaml | 2 +- src/presentation/http/router/auth.test.ts | 9 +++++---- src/tests/test-data/tokens.json | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5f2cd58c..7ad6b4ac 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -7,7 +7,7 @@ path: /auth summary: check, access, remove, refresh token requestBody: required: true - content: + content application/json: schema: $ref: '#/components/schemas/session' diff --git a/src/presentation/http/router/auth.test.ts b/src/presentation/http/router/auth.test.ts index 65c0cf4b..58512b8c 100644 --- a/src/presentation/http/router/auth.test.ts +++ b/src/presentation/http/router/auth.test.ts @@ -6,7 +6,7 @@ describe('Note API', () => { const response = await global.api?.fakeRequest({ method: 'POST', - url: '/auth/' // write not authorised data + url: '/auth' // write not authorised data }) expect(response?.statusCode).toBe(expectedStatus) @@ -20,13 +20,14 @@ describe('Note API', () => { const expectedStatus = 200 const expectedAuthReply = { - accessToken: '123', - refreshToken: '4567' + refreshToken: "pv-jIqfPj1", + accessToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksImlhdCI6MTY5ODc1NzQyMSwiZXhwIjoxNjk5NjU3NDIxfQ.g0PzlWpGkw4VQrMRulNrnnAFa3KxtF4buCjqxKV-wq4" + }; const response = await global.api?.fakeRequest({ method: 'POST', - url: ""//write authorised data + url: "/auth"//write authorised data }) expect(response?.statusCode).toBe(expectedStatus) diff --git a/src/tests/test-data/tokens.json b/src/tests/test-data/tokens.json index 2b008c81..f0e735d4 100644 --- a/src/tests/test-data/tokens.json +++ b/src/tests/test-data/tokens.json @@ -2,7 +2,6 @@ { "refreshToken": "pv-jIqfPj1", "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksImlhdCI6MTY5ODc1NzQyMSwiZXhwIjoxNjk5NjU3NDIxfQ.g0PzlWpGkw4VQrMRulNrnnAFa3KxtF4buCjqxKV-wq4", - "refresh_token_expires_at": "2023-10-31 10:23:54+02", "user_Id": "134", "Id":"1"