mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-16 16:01:22 +02:00
Use fs promises in actionUtils tests
This commit is contained in:
parent
f68f5d03cc
commit
65636697d3
1 changed files with 6 additions and 4 deletions
|
@ -343,13 +343,15 @@ test("isValidEvent returns true for pull request event", () => {
|
|||
});
|
||||
|
||||
test("unlinkFile unlinks file", async () => {
|
||||
const testDirectory = fs.mkdtempSync("unlinkFileTest");
|
||||
const testDirectory = await fs.mkdtemp("unlinkFileTest");
|
||||
const testFile = path.join(testDirectory, "test.txt");
|
||||
fs.writeFileSync(testFile, "hello world");
|
||||
await fs.writeFile(testFile, "hello world");
|
||||
|
||||
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…
Add table
Reference in a new issue