From f90c44a773bcfa7b9f391a86640d0926aa033ccf Mon Sep 17 00:00:00 2001 From: Parker Brown <17183625+parkerbxyz@users.noreply.github.com> Date: Fri, 13 Mar 2026 18:29:21 -0700 Subject: [PATCH] Remove redundant enterprise tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/index.js.snapshot | 27 ----------------- ...enterprise-mutual-exclusivity-both.test.js | 16 ---------- tests/main-enterprise-token-success.test.js | 30 ------------------- 3 files changed, 73 deletions(-) delete mode 100644 tests/main-enterprise-mutual-exclusivity-both.test.js delete mode 100644 tests/main-enterprise-token-success.test.js diff --git a/tests/index.js.snapshot b/tests/index.js.snapshot index 0681c49..b5b4215 100644 --- a/tests/index.js.snapshot +++ b/tests/index.js.snapshot @@ -34,16 +34,6 @@ Failed to create token for enterprise "test-enterprise" (attempt 1): No enterpri GET /enterprises/test-enterprise/installation `; -exports[`main-enterprise-mutual-exclusivity-both.test.js > stderr 1`] = ` -Error: Cannot use 'enterprise-slug' input with 'owner' or 'repositories' inputs - at main (file:///Users/parkerbxyz/.copilot/worktrees/create-github-app-token/pr-263/lib/main.js:31:11) - at run (file:///Users/parkerbxyz/.copilot/worktrees/create-github-app-token/pr-263/main.js:35:10) - at file:///Users/parkerbxyz/.copilot/worktrees/create-github-app-token/pr-263/main.js:50:16 - at ModuleJob.run (node:internal/modules/esm/module_job:430:25) - at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:639:26) - at async file:///Users/parkerbxyz/.copilot/worktrees/create-github-app-token/pr-263/tests/main-enterprise-mutual-exclusivity-both.test.js:13:3 -`; - exports[`main-enterprise-mutual-exclusivity-owner.test.js > stderr 1`] = ` Error: Cannot use 'enterprise-slug' input with 'owner' or 'repositories' inputs at main (file:///Users/parkerbxyz/.copilot/worktrees/create-github-app-token/pr-263/lib/main.js:31:11) @@ -81,23 +71,6 @@ POST /app/installations/123456/access_tokens null `; -exports[`main-enterprise-token-success.test.js > stdout 1`] = ` -Creating enterprise installation token for enterprise "test-enterprise". -::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a - -::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a - -::set-output name=installation-id::123456 - -::set-output name=app-slug::github-actions -::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a -::save-state name=expiresAt::2016-07-11T22:14:10Z ---- REQUESTS --- -GET /enterprises/test-enterprise/installation -POST /app/installations/123456/access_tokens -null -`; - exports[`main-enterprise-token-with-permissions.test.js > stdout 1`] = ` Creating enterprise installation token for enterprise "test-enterprise". ::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a diff --git a/tests/main-enterprise-mutual-exclusivity-both.test.js b/tests/main-enterprise-mutual-exclusivity-both.test.js deleted file mode 100644 index 521f6e5..0000000 --- a/tests/main-enterprise-mutual-exclusivity-both.test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { DEFAULT_ENV } from "./main.js"; - -// Verify `main` exits with an error when `enterprise-slug` is used with both `owner` and `repositories` inputs. -try { - // Set up environment with enterprise-slug, owner, and repositories all set - for (const [key, value] of Object.entries(DEFAULT_ENV)) { - process.env[key] = value; - } - process.env["INPUT_ENTERPRISE-SLUG"] = "test-enterprise"; - process.env.INPUT_OWNER = "test-owner"; - process.env.INPUT_REPOSITORIES = "repo1,repo2"; - - await import("../main.js"); -} catch (error) { - console.error(error.message); -} diff --git a/tests/main-enterprise-token-success.test.js b/tests/main-enterprise-token-success.test.js deleted file mode 100644 index 2128b7a..0000000 --- a/tests/main-enterprise-token-success.test.js +++ /dev/null @@ -1,30 +0,0 @@ -import { test } from "./main.js"; - -// Verify `main` successfully generates enterprise token with basic functionality. -await test((mockPool) => { - process.env["INPUT_ENTERPRISE-SLUG"] = "test-enterprise"; - delete process.env.INPUT_OWNER; - delete process.env.INPUT_REPOSITORIES; - - // Mock the enterprise installation endpoint - const mockInstallationId = "123456"; - const mockAppSlug = "github-actions"; - mockPool - .intercept({ - path: "/enterprises/test-enterprise/installation", - method: "GET", - headers: { - accept: "application/vnd.github.v3+json", - "user-agent": "actions/create-github-app-token", - // Intentionally omitting the `authorization` header, since JWT creation is not idempotent. - }, - }) - .reply( - 200, - { - id: mockInstallationId, - app_slug: mockAppSlug, - }, - { headers: { "content-type": "application/json" } } - ); -});