Skip to content

Commit

Permalink
feat: add team_settings introspection tests (#3909)
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 authored Nov 5, 2024
1 parent aa80b32 commit 5bb064a
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions hasura.planx.uk/tests/team_settings.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
const { introspectAs } = require("./utils");

describe("team_settings", () => {
describe("public", () => {
let i;
beforeAll(async () => {
i = await introspectAs("public");
});

test("can query team_settings", () => {
expect(i.queries).toContain("team_settings");
});

test("cannot create, update, or delete team_settings", () => {
expect(i).toHaveNoMutationsFor("team_settings");
});
});

describe("admin", () => {
let i;
beforeAll(async () => {
i = await introspectAs("admin");
});

test("can query team_settings and team members", () => {
expect(i.queries).toContain("team_settings");
});
});

describe("platformAdmin", () => {
let i;
beforeAll(async () => {
i = await introspectAs("platformAdmin");
});

test("can query team_settings", () => {
expect(i.queries).toContain("team_settings");
});

test("cannot query insert team_settings", () => {
expect(i.queries).not.toContain("insert_team_settings");
});

test("can query team_settings", async () => {
expect(i.queries).toContain("team_settings");
});

test("can insert team_settings", () => {
expect(i.mutations).toContain("insert_team_settings");
});

test("can mutate team_settings", async () => {
expect(i.mutations).toContain("update_team_settings");
expect(i.mutations).toContain("update_team_settings_by_pk");
});

test("cannot delete team_settings", async () => {
expect(i.mutations).not.toContain("delete_team_settings");
});
});

describe("teamEditor", () => {
beforeAll(async () => {
i = await introspectAs("teamEditor");
});

test("can query team_settings", () => {
expect(i.queries).toContain("team_settings");
});

test("can update team_settings", () => {
expect(i.mutations).toContain("update_team_settings");
expect(i.mutations).toContain("update_team_settings_by_pk");
});

test("cannot delete team_settings", async () => {
expect(i.mutations).not.toContain("delete_team_settings");
});

test("cannot insert team_settings", async () => {
expect(i.mutations).not.toContain("insert_team_settings");
});
});

describe("demoUser", () => {
let i;
beforeAll(async () => {
i = await introspectAs("demoUser");
});

test("can query team_settings", () => {
expect(i.queries).toContain("team_settings");
});

test("cannot create, update, or delete team_settings", () => {
expect(i).toHaveNoMutationsFor("team_settings");
});
});

describe("api", () => {
let i;
beforeAll(async () => {
i = await introspectAs("api");
});

test("can query team_settings", () => {
expect(i.queries).toContain("team_settings");
});

test("cannot create, update, or delete team_settings", () => {
expect(i).toHaveNoMutationsFor("team_settings");
});
});
});

0 comments on commit 5bb064a

Please sign in to comment.