0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00

fix(std): existsFile test

This commit is contained in:
Bartek Iwańczuk 2020-04-18 22:29:39 +02:00 committed by GitHub
parent ade05f3c00
commit e2fd729a0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,10 +6,12 @@ import { exists, existsSync } from "./_fs_exists.ts";
const { test } = Deno;
test(async function existsFile() {
const availableFile = await new Promise(async (resolve) => {
const tmpFilePath = await Deno.makeTempFile();
exists(tmpFilePath, (exists: boolean) => resolve(exists));
Deno.remove(tmpFilePath);
const availableFile = await new Promise((resolve) => {
const tmpFilePath = Deno.makeTempFileSync();
exists(tmpFilePath, (exists: boolean) => {
Deno.removeSync(tmpFilePath);
resolve(exists);
});
});
const notAvailableFile = await new Promise((resolve) => {
exists("./notAvailable.txt", (exists: boolean) => resolve(exists));