Skip to content

Commit

Permalink
test: add test for yarn.install function
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Feb 17, 2024
1 parent 195142a commit 57dc610
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/yarn.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,20 @@ it("should enable Yarn", async () => {
expect(exec).toHaveBeenCalledTimes(1);
expect(exec).toHaveBeenCalledWith("corepack", ["enable", "yarn"]);
});

it("should install package using Yarn", async () => {
const { exec } = await import("@actions/exec");
const yarn = (await import("./yarn.mjs")).default;

await yarn.install();

expect(exec).toHaveBeenCalledTimes(1);
expect(exec).toHaveBeenCalledWith("corepack", ["yarn", "install"], {
env: {
...process.env,
GITHUB_ACTIONS: "",
FORCE_COLOR: "true",
CI: "",
},
});
});

0 comments on commit 57dc610

Please sign in to comment.