From 0f71d4ac9a7f4c36aba5ac3cfc4567d2d4eae813 Mon Sep 17 00:00:00 2001 From: Dave Hadka Date: Tue, 29 Sep 2020 12:36:19 -0500 Subject: [PATCH] Add tests for isGhes --- __tests__/actionUtils.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/__tests__/actionUtils.test.ts b/__tests__/actionUtils.test.ts index a6dc291..7cd935c 100644 --- a/__tests__/actionUtils.test.ts +++ b/__tests__/actionUtils.test.ts @@ -17,6 +17,24 @@ afterEach(() => { delete process.env[RefKey]; }); +test("isGhes returns true if server url is not github.com", () => { + try { + process.env["GITHUB_SERVER_URL"] = "http://example.com"; + expect(actionUtils.isGhes()).toBe(true); + } finally { + process.env["GITHUB_SERVER_URL"] = undefined; + } +}); + +test("isGhes returns true when server url is github.com", () => { + try { + process.env["GITHUB_SERVER_URL"] = "http://github.com"; + expect(actionUtils.isGhes()).toBe(false); + } finally { + process.env["GITHUB_SERVER_URL"] = undefined; + } +}); + test("isExactKeyMatch with undefined cache key returns false", () => { const key = "linux-rust"; const cacheKey = undefined;