refactor: tmpdir and add to test utils
This commit is contained in:
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user