[#38] Adding several missing tests and correct CI setup

This commit is contained in:
Camille Moussu
2025-07-18 12:55:42 +02:00
parent 7c8b14e961
commit a52ded03fb
19 changed files with 2938 additions and 1278 deletions
+22
View File
@@ -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);
});
});