Files
speckle-server/packages/server/modules/core/helpers/testHelpers.ts
T
Kristaps Fabians Geikins 0085bab1db fix(server): fixed various email lookups/updates being case sensitive (#2595)
* fix(server): case insensitivity in userEmails repo

* minor fix

* more test improvements + user repo tests

* more tests

* test fixes
2024-08-07 17:48:01 +03:00

16 lines
404 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 const randomizeCase = (str: string) =>
str
.split('')
.map((char) => (Math.random() > 0.5 ? char.toUpperCase() : char.toLowerCase()))
.join('')