0ac36af93e
* 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
20 lines
500 B
TypeScript
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('')
|