Archived
1
0

refactor: tmpdir and add to test utils

This commit is contained in:
Joe Previte
2021-04-23 14:28:39 -07:00
parent b0ecff338f
commit 7bfdd13cb3
4 changed files with 41 additions and 33 deletions

View File

@ -1,4 +1,6 @@
import * as fs from "fs"
import { commit, getPackageJson, version } from "../../src/node/constants"
import { tmpdir } from "../../test/utils/constants"
import { loggerModule } from "../utils/helpers"
// jest.mock is hoisted above the imports so we must use `require` here.
@ -51,3 +53,16 @@ describe("constants", () => {
})
})
})
describe("test constants", () => {
describe("tmpdir", () => {
it("should return a temp directory", async () => {
const testName = "temp-dir"
const pathToTempDir = await tmpdir(testName)
expect(pathToTempDir).toContain(testName)
await fs.promises.rmdir(pathToTempDir)
})
})
})