import { createRole } from "../utils/role-factory";
import { test as base } from "./user";

type RoleFixture = Awaited<ReturnType<typeof createRole>>;

interface TestFixtures {
  SelectableRole: RoleFixture;
}

export const test = base.extend<TestFixtures>({
  // oxlint-disable-next-line no-empty-pattern
  SelectableRole: async ({}, use) => {
    const role = await createRole({
      name: `SelectableRole ${Date.now()}`,
      permissions: ["user-management:role"],
    });
    await use(role);
  },
});

export const expect = test.expect;
