Files
speckle-server/packages/server/modules/core/helpers/testHelpers.ts
T
Alessandro Magionami 0ac36af93e Alessandro/web 1659 workspace limits (#2733)
* chore(workspaces): billing version limit graphql schema

* chore(workspaces): billing member role required

* chore(core): test helper for random string

* chore(core): test helpers

* chore(workspaces): workspaces billing version resolver

* chore(workspaces): rename version to versionsCount
2024-08-26 17:53:34 +02:00

20 lines
500 B
TypeScript

import crs from 'crypto-random-string'
export function createRandomEmail() {
return randomizeCase(`${crs({ length: 6 })}@example.org`)
}
export function createRandomPassword(length?: number) {
return crs({ length: length ?? 10 })
}
export function createRandomString(length?: number) {
return crs({ length: length ?? 10 })
}
export const randomizeCase = (str: string) =>
str
.split('')
.map((char) => (Math.random() > 0.5 ? char.toUpperCase() : char.toLowerCase()))
.join('')