fix: using jest.mocked method
Some checks failed
CI Pipeline / build-and-test (push) Failing after 1m26s
CI Pipeline / publish (push) Has been skipped

This commit is contained in:
Leandro Costa 2025-06-27 14:00:22 -03:00
parent 1186f3f835
commit 86704b83b1

View file

@ -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" } });
});