#601 event creation prefill resources (#641)

Co-authored-by: lethemanh <lethemanh@lethemanhs-MacBook-Pro.local>
This commit is contained in:
lethemanh
2026-03-18 17:31:29 +07:00
committed by GitHub
parent daf7257292
commit 3a84756872
9 changed files with 83 additions and 41 deletions
+21
View File
@@ -3,6 +3,7 @@ import {
getOpenPaasUser,
updateUserConfigurations,
getResourceDetails,
getUserDetails,
} from "@/features/User/userAPI";
import { api } from "@/utils/apiUtils";
@@ -25,6 +26,26 @@ describe("getOpenPaasUser", () => {
});
});
describe("getUserDetails", () => {
it("should fetch and return user details", async () => {
const mockUser = {
firstname: "John",
lastname: "Doe",
emails: ["john@test.com"],
};
const userId = "123";
(api.get as jest.Mock).mockReturnValue({
json: jest.fn().mockResolvedValue(mockUser),
});
const result = await getUserDetails(userId);
expect(api.get).toHaveBeenCalledWith(`api/users/${userId}`);
expect(result).toEqual(mockUser);
});
});
describe("getResourceDetails", () => {
it("should fetch and return resource details", async () => {
const mockResource = { _id: "res-123", name: "Meeting Room A" };