Adicionando grantType aos testes
This commit is contained in:
parent
a72fe1d9c8
commit
ee68092e23
1 changed files with 8 additions and 5 deletions
|
@ -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,
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue