Skip to content

Commit

Permalink
test: Hasura introspection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 20, 2024
1 parent 42453d2 commit eade504
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions hasura.planx.uk/tests/flow_status_history.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
const { introspectAs } = require("./utils");

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

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

test("cannot create, update, or delete flows or their associated operations", () => {
expect(i).toHaveNoMutationsFor("flow_status_history");
});
});

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

test("has full access to flow_status_history", () => {
expect(i.queries).toContain("flow_status_history");
expect(i.mutations).toContain("insert_flow_status_history");
expect(i.mutations).toContain("insert_flow_status_history_one");
expect(i.mutations).toContain("update_flow_status_history_by_pk");
expect(i.mutations).toContain("delete_flow_status_history");
});
});

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

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

test("cannot create, update, or delete flows or their associated operations", () => {
expect(i).toHaveNoMutationsFor("flow_status_history");
});
});

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

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

test("cannot create, update, or delete flows or their associated operations", () => {
expect(i).toHaveNoMutationsFor("flow_status_history");
});
});

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

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

test("cannot create, update, or delete flows or their associated operations", () => {
expect(i).toHaveNoMutationsFor("flow_status_history");
});
});
});

0 comments on commit eade504

Please sign in to comment.