From 6281061c0d9ca0dbde316f3059e931df883b7273 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Sat, 18 Jan 2020 12:33:56 +0900 Subject: [PATCH] test: Add test for extended option (#134) --- __tests__/main.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 7b95c7a..4ca1956 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -32,6 +32,16 @@ describe('Integration testing run()', () => { expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`); }); + test('succeed in installing a custom extended version', async () => { + const testVersion = Tool.TestVersionSpec; + process.env['INPUT_HUGO-VERSION'] = testVersion; + process.env['INPUT_EXTENDED'] = 'true'; + const result: main.ActionResult = await main.run(); + expect(result.exitcode).toBe(0); + expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`); + expect(result.output).toMatch(`extended`); + }); + test('succeed in installing the latest version', async () => { const testVersion = 'latest'; process.env['INPUT_HUGO-VERSION'] = testVersion; @@ -44,6 +54,21 @@ describe('Integration testing run()', () => { `Hugo Static Site Generator v${Tool.TestVersionLatest}` ); }); + + test('succeed in installing the latest extended version', async () => { + const testVersion = 'latest'; + process.env['INPUT_HUGO-VERSION'] = testVersion; + process.env['INPUT_EXTENDED'] = 'true'; + nock('https://formulae.brew.sh') + .get(`/api/formula/${Tool.Repo}.json`) + .reply(200, jsonTestBrew); + const result: main.ActionResult = await main.run(); + expect(result.exitcode).toBe(0); + expect(result.output).toMatch( + `Hugo Static Site Generator v${Tool.TestVersionLatest}` + ); + expect(result.output).toMatch(`extended`); + }); }); describe('showVersion()', () => {