mirror of https://github.com/actions/cache.git
Use fs promises in actionUtils tests
This commit is contained in:
parent
f68f5d03cc
commit
65636697d3
|
@ -343,13 +343,15 @@ test("isValidEvent returns true for pull request event", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("unlinkFile unlinks file", async () => {
|
test("unlinkFile unlinks file", async () => {
|
||||||
const testDirectory = fs.mkdtempSync("unlinkFileTest");
|
const testDirectory = await fs.mkdtemp("unlinkFileTest");
|
||||||
const testFile = path.join(testDirectory, "test.txt");
|
const testFile = path.join(testDirectory, "test.txt");
|
||||||
fs.writeFileSync(testFile, "hello world");
|
await fs.writeFile(testFile, "hello world");
|
||||||
|
|
||||||
await actionUtils.unlinkFile(testFile);
|
await actionUtils.unlinkFile(testFile);
|
||||||
|
|
||||||
expect(fs.existsSync(testFile)).toBe(false);
|
await expect(fs.stat(testFile)).rejects.toThrow(
|
||||||
|
`ENOENT: no such file or directory, stat '${testFile}'`
|
||||||
|
);
|
||||||
|
|
||||||
fs.rmdirSync(testDirectory);
|
await fs.rmdir(testDirectory);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue