import { describe, expect, it } from "vitest";
import { defaultGqlPermission, defaultPermission } from "./modelPermissions";

describe("defaultPermission", () => {
  it("permits all CRUD operations unconditionally", () => {
    const expected = [{ conditions: [], permit: true }];
    expect(defaultPermission.create).toEqual(expected);
    expect(defaultPermission.read).toEqual(expected);
    expect(defaultPermission.update).toEqual(expected);
    expect(defaultPermission.delete).toEqual(expected);
  });
});

describe("defaultGqlPermission", () => {
  it("allows read and aggregate only, no mutations", () => {
    expect(defaultGqlPermission).toEqual([
      {
        conditions: [],
        actions: ["read", "aggregate"],
        permit: true,
      },
    ]);
  });
});
