From ee68092e23edddcfab61d584b06a271e60d90504 Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Thu, 26 Jan 2023 23:06:09 -0300 Subject: [PATCH] Adicionando grantType aos testes --- __tests__/lhisp-oauth-client.test.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/__tests__/lhisp-oauth-client.test.ts b/__tests__/lhisp-oauth-client.test.ts index e452e46..a5932c9 100644 --- a/__tests__/lhisp-oauth-client.test.ts +++ b/__tests__/lhisp-oauth-client.test.ts @@ -13,9 +13,10 @@ const clientSecret = "testClientSecret"; const baseClientParams = { apiUrl, authUrl, clientId, clientSecret }; const basicAuth = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`; const contentTypeApplicationJson = "application/json"; +const defaultGrantType='{"grant_type":"client_credentials"}'; describe("lhisp-oauth-client", ()=>{ - it("Shout Get Access Token with Standard Config", async ()=>{ + it("Shoud Get Access Token with Standard Config", async ()=>{ const cli = getOauthClient(); mockedAxios.request.mockReset(); mockedAxios.request.mockResolvedValueOnce({ @@ -36,14 +37,15 @@ describe("lhisp-oauth-client", ()=>{ headers: { Authorization: basicAuth, 'Content-Type': contentTypeApplicationJson, - } + }, + data: defaultGrantType, })); }); - it("Shout Get Access Token with Custom Auth Header", async ()=>{ + it("Shoud Get Access Token with Custom Auth Header", async ()=>{ const cli = getOauthClient({ ...baseClientParams, - authHeaderName: "CustomAuthorizationHeader" + authHeaderName: 'CustomAuthorizationHeader', }); mockedAxios.request.mockReset(); mockedAxios.request.mockResolvedValueOnce({ @@ -64,7 +66,8 @@ describe("lhisp-oauth-client", ()=>{ headers: { CustomAuthorizationHeader: basicAuth, 'Content-Type': contentTypeApplicationJson, - } + }, + data: defaultGrantType, })); }); });