Files
speckle-server/packages/server/modules/core/helpers/testHelpers.ts
T
Alessandro Magionami 0c18acc452 Alessandro/web 2945 comments hide body (#4385)
* chore(core): move limits logic into shared

* feat(comments): limit text and rawText for comments

* chore(core): removed test moved to shared

* chore(comments): generate gql types

* feat(comments): rework comment history limits

* chore(comments): fix tests

* chore(shared): add dayjs as dependency

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
2025-04-15 10:44:12 +02:00

23 lines
545 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 })
}
/**
* @deprecated use the one in shared
*/
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('')