Skip to content

Commit

Permalink
test: add test for json branches input
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarJaroudi committed Sep 28, 2023
1 parent 0c9da75 commit 096f7a7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions semantic-release/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,30 @@ describe("semantic-release", () => {
`);
});

test("supports JSON `branches` input", async () => {
process.env.SEMANTIC_ACTION_BRANCHES =
'["test", {"name": "test-branch", "channel": "next"}]';
process.env.SEMANTIC_ACTION_CI = "true";
process.env.SEMANTIC_ACTION_DRY_RUN = "true";
mockNpmInstall();
mockRelease({ nextRelease: undefined });
await callAction();
expect(semanticReleaseMock).toHaveBeenCalledTimes(1);
expect(semanticReleaseMock.mock.calls[0][0]).toMatchInlineSnapshot(`
{
"branches": [
"test",
{
"channel": "next",
"name": "test-branch",
},
],
"ci": true,
"dryRun": true,
}
`);
});

test("installs the specified version of semantic release", async () => {
process.env.SEMANTIC_ACTION_SEMANTIC_VERSION = "1.0.0";
mockNpmInstall();
Expand Down

0 comments on commit 096f7a7

Please sign in to comment.