fix: using jest.mocked method
This commit is contained in:
parent
1186f3f835
commit
86704b83b1
1 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,7 @@ import { ContentType, LhispOauthClientConstructorParams } from "../src/lhisp-oau
|
|||
|
||||
// Mock jest and set the type
|
||||
jest.mock("axios");
|
||||
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
||||
const mockedAxios = jest.mocked(axios);
|
||||
|
||||
const apiUrl = "https://myapi.com";
|
||||
const authUrl = "https://auth.myapi.com/oauth/token";
|
||||
|
@ -19,7 +19,7 @@ const defaultGrantType = `grant_type=${defaultGrantValue}`;
|
|||
|
||||
describe("Get Access Token", () => {
|
||||
beforeEach(() => {
|
||||
// mockedAxios.request.mockReset();
|
||||
mockedAxios.request.mockReset();
|
||||
mockedAxios.request.mockResolvedValueOnce({ data: mockedAccessToken });
|
||||
});
|
||||
|
||||
|
@ -109,7 +109,7 @@ describe("Get Access Token", () => {
|
|||
|
||||
describe("Request", () => {
|
||||
beforeEach(() => {
|
||||
// mockedAxios.request.mockReset();
|
||||
mockedAxios.request.mockReset();
|
||||
mockedAxios.request.mockResolvedValueOnce({ data: mockedAccessToken });
|
||||
mockedAxios.request.mockResolvedValueOnce({ data: { status: "ok" } });
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue