@@ -2,6 +2,7 @@ import { clientConfig } from "@/features/User/oidcAuth";
|
||||
import {
|
||||
getOpenPaasUser,
|
||||
updateUserConfigurations,
|
||||
getResourceDetails,
|
||||
} from "@/features/User/userAPI";
|
||||
import { api } from "@/utils/apiUtils";
|
||||
|
||||
@@ -24,6 +25,24 @@ describe("getOpenPaasUser", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("getResourceDetails", () => {
|
||||
it("should fetch and return resource details", async () => {
|
||||
const mockResource = { _id: "res-123", name: "Meeting Room A" };
|
||||
const resourceId = "res-123";
|
||||
|
||||
(api.get as jest.Mock).mockReturnValue({
|
||||
json: jest.fn().mockResolvedValue(mockResource),
|
||||
});
|
||||
|
||||
const result = await getResourceDetails(resourceId);
|
||||
|
||||
expect(api.get).toHaveBeenCalledWith(
|
||||
`linagora.esn.resource/api/resources/${resourceId}`
|
||||
);
|
||||
expect(result).toEqual(mockResource);
|
||||
});
|
||||
});
|
||||
|
||||
describe("updateUserConfigurations", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user