Files
yasser khanandGitHub e759eab52d Feat(e2e): Add tests cases for Content Flagging (#34288)
- E2E tests for Content Flagging 
- Fixes tests failing on master
2025-11-19 10:16:57 +00:00

17 lines
467 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
let uuidv4: (() => string) | null = null;
export async function getRandomId(length = 7): Promise<string> {
if (!uuidv4) {
const {v4} = await import('uuid');
uuidv4 = v4;
}
const MAX_SUBSTRING_INDEX = 27;
return uuidv4()
.replace(/-/g, '')
.substring(MAX_SUBSTRING_INDEX - length, MAX_SUBSTRING_INDEX);
}