Do not allow empty names on request

This commit is contained in:
Adria Navarro 2023-05-08 12:42:51 +02:00
parent 752790f3c9
commit 1b44f8b18b
2 changed files with 17 additions and 1 deletions

@ -1 +1 @@
Subproject commit 151e785f0ac38054f3930ca4b04e191a31c733f5
Subproject commit 124280d24ff60446c166a005e3cc09c986565bb3

View File

@ -32,6 +32,22 @@ describe("/api/global/groups", () => {
'Invalid body - "name" is required'
)
})
it("should not allow empty names", async () => {
const group = { ...structures.groups.UserGroup(), name: "" }
const response = await config.api.groups.saveGroup(group, { expect: 400 })
expect(JSON.parse(response.text).message).toEqual(
'Invalid body - "name" is not allowed to be empty'
)
})
it("should not allow whitespace names", async () => {
const group = { ...structures.groups.UserGroup(), name: " " }
const response = await config.api.groups.saveGroup(group, { expect: 400 })
expect(JSON.parse(response.text).message).toEqual(
'Invalid body - "name" is not allowed to be empty'
)
})
})
describe("update", () => {