- Add formatError() helper in CLI to safely handle unknown error types - Add uniqueTestId() helper for generating unique test identifiers - Replace String(id) with id.toString() for database ID conversions - Replace String(n) with n.toLocaleString() for user-facing number formatting - Fix TypeScript errors in test files (undefined checks, unused variables) - Update lint commands to include ast-grep scanning Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
16 lines
407 B
TypeScript
16 lines
407 B
TypeScript
/**
|
|
* Test utility functions
|
|
*/
|
|
|
|
/**
|
|
* Generates a unique test ID using timestamp and random string.
|
|
* Useful for creating unique emails, slugs, tokens, etc. in tests.
|
|
*
|
|
* @example
|
|
* const email = `user-${uniqueTestId()}@example.com`
|
|
* const slug = `org-${uniqueTestId()}`
|
|
*/
|
|
export function uniqueTestId(): string {
|
|
return `${Date.now().toString()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
}
|