From fd370e4159b74f5ddb0d5be86fa09fd47615f0d3 Mon Sep 17 00:00:00 2001 From: Omar Jaroudi Date: Thu, 28 Sep 2023 20:29:37 +0000 Subject: [PATCH] test: add test for json branches input --- semantic-release/test/index.test.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/semantic-release/test/index.test.ts b/semantic-release/test/index.test.ts index a7a5e6b..408b3e9 100644 --- a/semantic-release/test/index.test.ts +++ b/semantic-release/test/index.test.ts @@ -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();