import { sections } from "@/helpers/umbraco-auth-policies.js";
import { UserGroupTools } from "../index.js";
import { CurrentUserResponseModel } from "@/umb-management-api/schemas/currentUserResponseModel.js";
describe("user-group-tool-index", () => {
it("should have no tools by default", () => {
const userMock = {
allowedSections: []
} as Partial<CurrentUserResponseModel>;
const tools = UserGroupTools(userMock as CurrentUserResponseModel);
expect(tools.map(t => t.name)).toMatchSnapshot();
});
it("should have all tools when user has users section access", () => {
const userMock = {
allowedSections: [sections.users]
} as Partial<CurrentUserResponseModel>;
const tools = UserGroupTools(userMock as CurrentUserResponseModel);
expect(tools.map(t => t.name)).toMatchSnapshot();
});
it("should have tool with get user group", () => {
const userMock = {
allowedSections: []
} as Partial<CurrentUserResponseModel>;
const tools = UserGroupTools(userMock as CurrentUserResponseModel);
expect(tools.map(t => t.name)).toMatchSnapshot();
});
});