[#38] Adding several missing tests and correct CI setup
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { clientConfig } from "../../../src/features/User/oidcAuth";
|
||||
import getOpenPaasUserId from "../../../src/features/User/userAPI";
|
||||
import { api } from "../../../src/utils/apiUtils";
|
||||
|
||||
jest.mock("../../../src/utils/apiUtils");
|
||||
|
||||
clientConfig.url = "https://example.com";
|
||||
|
||||
describe("getOpenPaasUserId", () => {
|
||||
it("should fetch and return user data", async () => {
|
||||
const mockUser = { id: "123", name: "OpenPaas User" };
|
||||
|
||||
(api.get as jest.Mock).mockReturnValue({
|
||||
json: jest.fn().mockResolvedValue(mockUser),
|
||||
});
|
||||
|
||||
const result = await getOpenPaasUserId();
|
||||
|
||||
expect(api.get).toHaveBeenCalledWith("api/user");
|
||||
expect(result).toEqual(mockUser);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user