Skip to content

Commit

Permalink
Fix rndName
Browse files Browse the repository at this point in the history
  • Loading branch information
svsool committed Jul 28, 2020
1 parent 897d8d7 commit 5d22b37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
File renamed without changes.
7 changes: 5 additions & 2 deletions src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ export const removeFile = async (filename: string) =>
Uri.file(path.join(utils.getWorkspaceFolder()!, ...filename.split('/'))),
);

export const rndName = (): string =>
Math.random()
export const rndName = (): string => {
const name = Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, 5);

return name.length !== 5 ? rndName() : name;
};

export const openTextDocument = async (filename: string) =>
await workspace.openTextDocument(path.join(utils.getWorkspaceFolder()!, filename));

Expand Down

0 comments on commit 5d22b37

Please sign in to comment.