Skip to content

Commit 2926fd2

Browse files
parker-snykd3vco
authored andcommitted
test: fix mkdtemp assertion broken by #779 (#792)
test: fix mkdtemp assertion to match current call signature The assertion in the "should successfully persist modules" test was checking that mkdtemp was called with "snyk", which was the argument before PR #779 switched to path.join(os.tmpdir(), "snyk-"). The test was added in PR #788 after #779 had already landed, so it was born broken. Fix: import os and update the toHaveBeenCalledWith arg to path.join(os.tmpdir(), "snyk-") so it matches what the source actually passes at runtime.
1 parent d1b4dfb commit 2926fd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/lib/analyzer/applications/node-modules-utils.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as fsPromises from "fs/promises";
2+
import * as os from "os";
23
import * as path from "path";
34
import { persistNodeModules } from "../../../../lib/analyzer/applications/node-modules-utils";
45
import {
@@ -84,7 +85,7 @@ describe("node-modules-utils", () => {
8485
),
8586
});
8687

87-
expect(mockMkdtemp).toHaveBeenCalledWith("snyk");
88+
expect(mockMkdtemp).toHaveBeenCalledWith(path.join(os.tmpdir(), "snyk-"));
8889
expect(mockMkdir).toHaveBeenCalledWith(expectedTempProjectPath, {
8990
recursive: true,
9091
});

0 commit comments

Comments
 (0)