8 lines
297 B
TypeScript
8 lines
297 B
TypeScript
/** Build stable data-testid values for E2E. */
|
|
export function testid(parts: Array<string | number | undefined | null>): string {
|
|
return parts
|
|
.filter((p) => p !== undefined && p !== null && `${p}`.length > 0)
|
|
.map((p) => String(p).replace(/\s+/g, '-'))
|
|
.join('-');
|
|
}
|