-
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.
fix: tests for the newly added features and reorganize old role test
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/controllers/rolesPermissionControllers/__tests__/roles.test.ts
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,25 @@ | ||
import supertest from "supertest"; | ||
import createServer from "../../../utils/server"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const app = createServer(); | ||
let token; | ||
beforeAll(async () => { | ||
const res = await supertest(app).post("/login").send({ | ||
email: "[email protected]", | ||
password: "adminpass", | ||
}); | ||
token = res.body.token; | ||
}, 40000); | ||
|
||
describe("Admin Manage roles", () => { | ||
describe("Authorised Access", () => { | ||
test("View All Roles", async () => { | ||
const response = await supertest(app).get("/role"); | ||
expect(response.status).toBe(404); | ||
}, 60000); | ||
test("Get role by name", async () => { | ||
const response = await supertest(app).get("/role/admin"); | ||
expect(response.status).toBe(404); | ||
}, 60000); | ||
}); | ||
}); |