This commit is contained in:
Adria Navarro 2023-05-08 15:16:41 +02:00
parent 5e7a8f18e5
commit 63244e1dde
3 changed files with 31 additions and 1 deletions

@ -1 +1 @@
Subproject commit a0a7b5e1566467cc0625fb69309364c750847962
Subproject commit ae1dd6f353cb8a124e3738fb1a58214db6b2df08

View File

@ -1,5 +1,8 @@
import { events } from "@budibase/backend-core"
import { structures, TestConfiguration, mocks } from "../../../../tests"
import { UserGroup } from "@budibase/types"
mocks.licenses.useGroups()
describe("/api/global/groups", () => {
const config = new TestConfiguration()
@ -113,4 +116,23 @@ describe("/api/global/groups", () => {
})
})
})
describe("find users", () => {
describe("without users", () => {
let group: UserGroup
beforeAll(async () => {
group = structures.groups.UserGroup()
await config.api.groups.saveGroup(group)
})
it("should return empty", async () => {
const result = await config.api.groups.searchUsers(group._id!)
expect(result.body).toEqual({
users: [],
bookmark: undefined,
hasNextPage: false,
})
})
})
})
})

View File

@ -23,4 +23,12 @@ export class GroupsAPI extends TestAPI {
.expect("Content-Type", /json/)
.expect(200)
}
searchUsers = (id: string) => {
return this.request
.get(`/api/global/groups/${id}/users`)
.set(this.config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
}
}