Merge pull request #10514 from Budibase/budi-6158/limit_group_name_length
Add group name length limit
This commit is contained in:
commit
09f93efe8a
2 changed files with 26 additions and 1 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 124280d24ff60446c166a005e3cc09c986565bb3
|
||||
Subproject commit 3a6dba1a7292384553900a284fa63422ee070bfa
|
|
@ -57,6 +57,31 @@ describe("/api/global/groups", () => {
|
|||
expect.objectContaining({ name: "group name" })
|
||||
)
|
||||
})
|
||||
|
||||
describe("name max length", () => {
|
||||
const maxLength = 50
|
||||
|
||||
it(`should allow names shorter than ${maxLength} characters`, async () => {
|
||||
const group = {
|
||||
...structures.groups.UserGroup(),
|
||||
name: structures.generator.word({ length: maxLength }),
|
||||
}
|
||||
await config.api.groups.saveGroup(group, { expect: 200 })
|
||||
})
|
||||
|
||||
it(`should not allow names longer than ${maxLength} characters`, async () => {
|
||||
const group = {
|
||||
...structures.groups.UserGroup(),
|
||||
name: structures.generator.word({ length: maxLength + 1 }),
|
||||
}
|
||||
const response = await config.api.groups.saveGroup(group, {
|
||||
expect: 400,
|
||||
})
|
||||
expect(JSON.parse(response.text).message).toEqual(
|
||||
'Invalid body - "name" length must be less than or equal to 50 characters long'
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("update", () => {
|
||||
|
|
Loading…
Reference in a new issue