import path from 'path'; /** * 补全路径到测试文件夹 * @param fileName 文件名 */ export function getTestPath(fileName = ''): string { return path.join(__dirname, '../../', 'test-temp', fileName); } /** * 生成随机字符串 * @param length */ export function randomString(length = 6): string { const str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let result = ''; for (let i = length; i > 0; i -= 1) { result += str[Math.floor(Math.random() * str.length)]; } return result; }