From 5bb064a41ac19b93364ddb52d701b3ef6257efb1 Mon Sep 17 00:00:00 2001 From: Rory Doak <138574807+RODO94@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:15:14 +0000 Subject: [PATCH] feat: add `team_settings` introspection tests (#3909) --- hasura.planx.uk/tests/team_settings.test.js | 114 ++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 hasura.planx.uk/tests/team_settings.test.js diff --git a/hasura.planx.uk/tests/team_settings.test.js b/hasura.planx.uk/tests/team_settings.test.js new file mode 100644 index 0000000000..4a97c6636e --- /dev/null +++ b/hasura.planx.uk/tests/team_settings.test.js @@ -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"); + }); + }); +});