Dynamic groups for testing
This commit is contained in:
parent
e318eda5f4
commit
8bbfa7e0ab
|
@ -1,10 +1,25 @@
|
|||
import { generator } from "@budibase/backend-core/tests"
|
||||
import { db } from "@budibase/backend-core"
|
||||
import { UserGroupRoles } from "@budibase/types"
|
||||
|
||||
export const UserGroup = () => {
|
||||
const appsCount = generator.integer({ min: 0, max: 3 })
|
||||
const roles = Array.from({ length: appsCount }).reduce(
|
||||
(p: UserGroupRoles, v) => {
|
||||
return {
|
||||
...p,
|
||||
[db.generateAppID()]: generator.pickone(["ADMIN", "POWER", "BASIC"]),
|
||||
}
|
||||
},
|
||||
{}
|
||||
)
|
||||
|
||||
let group = {
|
||||
apps: [],
|
||||
color: "var(--spectrum-global-color-blue-600)",
|
||||
icon: "UserGroup",
|
||||
name: "New group",
|
||||
roles: { app_uuid1: "ADMIN", app_uuid2: "POWER" },
|
||||
color: generator.color(),
|
||||
icon: generator.word(),
|
||||
name: generator.word({ length: 2 }),
|
||||
roles: roles,
|
||||
users: [],
|
||||
}
|
||||
return group
|
||||
|
|
Loading…
Reference in New Issue