Test name trimming

This commit is contained in:
Adria Navarro 2023-05-08 12:45:30 +02:00
parent 1b44f8b18b
commit cd47bc20a2
1 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@ describe("/api/global/groups", () => {
}) })
beforeEach(async () => { beforeEach(async () => {
jest.resetAllMocks()
mocks.licenses.useGroups() mocks.licenses.useGroups()
}) })
@ -48,6 +49,14 @@ describe("/api/global/groups", () => {
'Invalid body - "name" is not allowed to be empty' 'Invalid body - "name" is not allowed to be empty'
) )
}) })
it("should trim names", async () => {
const group = { ...structures.groups.UserGroup(), name: " group name " }
await config.api.groups.saveGroup(group)
expect(events.group.created).toBeCalledWith(
expect.objectContaining({ name: "group name" })
)
})
}) })
describe("update", () => { describe("update", () => {