-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add permission tests for team_themes table
- Loading branch information
1 parent
34a9f57
commit 1852600
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
const { introspectAs } = require("./utils"); | ||
|
||
describe("team_themes", () => { | ||
describe("public", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("public"); | ||
}); | ||
|
||
test("can query team_themes", () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
|
||
test("cannot create, update, or delete team_themes", () => { | ||
expect(i).toHaveNoMutationsFor("team_themes"); | ||
}); | ||
}); | ||
|
||
describe("admin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("admin"); | ||
}); | ||
|
||
test("can query team_themes and team members", () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
}); | ||
|
||
describe("platformAdmin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("platformAdmin"); | ||
}); | ||
|
||
test("can query team_themes", () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
|
||
test("cannot insert team_themes", () => { | ||
expect(i.queries).not.toContain("insert_team_themes"); | ||
}); | ||
|
||
test("can query team_themes", async () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
|
||
test("can mutate team_themes", async () => { | ||
expect(i.mutations).toContain("update_team_themes"); | ||
expect(i.mutations).toContain("update_team_themes_by_pk"); | ||
}); | ||
|
||
test("cannot delete team_themes", async () => { | ||
expect(i.mutations).not.toContain("delete_team_themes"); | ||
}); | ||
}); | ||
|
||
describe("teamEditor", () => { | ||
beforeAll(async () => { | ||
i = await introspectAs("teamEditor"); | ||
}); | ||
|
||
test("can query team_themes", () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
|
||
test("can update team_themes", () => { | ||
expect(i.mutations).toContain("update_team_themes"); | ||
expect(i.mutations).toContain("update_team_themes_by_pk"); | ||
}); | ||
|
||
test("cannot delete team_themes", async () => { | ||
expect(i.mutations).not.toContain("delete_team_themes"); | ||
}); | ||
|
||
test("cannot insert team_themes", async () => { | ||
expect(i.mutations).not.toContain("insert_team_themes"); | ||
}); | ||
}); | ||
|
||
describe("api", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("api"); | ||
}); | ||
|
||
test("can query team_themes", () => { | ||
expect(i.queries).toContain("team_themes"); | ||
}); | ||
|
||
test("cannot create, update, or delete team_themes", () => { | ||
expect(i).toHaveNoMutationsFor("team_themes"); | ||
}); | ||
}); | ||
}); |