1
0
Fork 0
mirror of synced 2024-09-20 11:27:56 +12:00

Fix tests

This commit is contained in:
Adria Navarro 2024-07-10 13:36:07 +02:00
parent 8b40e80750
commit 3f5161aaf7
3 changed files with 8 additions and 8 deletions

View file

@ -203,7 +203,7 @@ describe("/permission", () => {
// replicate changes before checking permissions
await config.publish()
await config.api.viewV2.publicSearch(view.id, undefined, { status: 403 })
await config.api.viewV2.publicSearch(view.id, undefined, { status: 401 })
})
it("should ignore the view permissions if the flag is not on", async () => {
@ -221,7 +221,7 @@ describe("/permission", () => {
await config.publish()
await config.api.viewV2.publicSearch(view.id, undefined, {
status: 403,
status: 401,
})
})
@ -250,8 +250,8 @@ describe("/permission", () => {
.send(basicRow(table._id))
.set(config.publicHeaders())
.expect("Content-Type", /json/)
.expect(403)
expect(res.status).toEqual(403)
.expect(401)
expect(res.status).toEqual(401)
})
})

View file

@ -1490,7 +1490,7 @@ describe.each([
it("does not allow public users to fetch by default", async () => {
await config.publish()
await config.api.viewV2.publicSearch(view.id, undefined, {
status: 403,
status: 401,
})
})
@ -1534,7 +1534,7 @@ describe.each([
await config.publish()
await config.api.viewV2.publicSearch(view.id, undefined, {
status: 403,
status: 401,
})
})
})

View file

@ -105,7 +105,7 @@ describe("Authorization middleware", () => {
it("throws when no user data is present in context", async () => {
await config.executeMiddleware()
expect(config.throw).toHaveBeenCalledWith(403, "No user info found")
expect(config.throw).toHaveBeenCalledWith(401, "No user info found")
})
it("passes on to next() middleware if user is an admin", async () => {
@ -157,7 +157,7 @@ describe("Authorization middleware", () => {
await config.executeMiddleware()
expect(config.throw).toHaveBeenCalledWith(
403,
401,
"Session not authenticated"
)
})