api tests for links

This commit is contained in:
Martin Aeschlimann
2019-02-15 10:06:34 +01:00
parent 56a6746adc
commit 76323b1ac7
2 changed files with 40 additions and 3 deletions

View File

@@ -12,9 +12,9 @@ export function rndName() {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
}
export function createRandomFile(contents = '', dir: string = os.tmpdir()): Thenable<vscode.Uri> {
export function createRandomFile(contents = '', dir: string = os.tmpdir(), ext = ''): Thenable<vscode.Uri> {
return new Promise((resolve, reject) => {
const tmpFile = join(dir, rndName());
const tmpFile = join(dir, rndName() + ext);
fs.writeFile(tmpFile, contents, (error) => {
if (error) {
return reject(error);