Skip to content

Commit

Permalink
Update tests to use admin jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffplays2005 committed Nov 2, 2024
1 parent 48c3a2c commit 905357c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/middleware/tests/AdminController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,15 +862,21 @@ describe("AdminController endpoint tests", () => {

it("should return the event details for a valid event ID", async () => {
const { id: id1 } = await eventService.createEvent(event1)
const res = await request.get(`/admin/events/${id1}`).send()
const res = await request
.get(`/admin/events/${id1}`)
.set("Authorization", `Bearer ${adminToken}`)
.send()
expect(res.status).toEqual(200)
expect(res.body.data).toBeDefined()
expect(res.body.data.title).toEqual("UASC New event")
expect(res.body.data.location).toEqual("UASC")
})

it("should return 404 if the event does not exist", async () => {
const res = await request.get("/admin/events/random-event").send()
const res = await request
.get("/admin/events/random-event")
.set("Authorization", `Bearer ${adminToken}`)
.send()
expect(res.status).toEqual(404)
expect(res.body.error).toEqual("Event not found.")
})
Expand Down

0 comments on commit 905357c

Please sign in to comment.