Dashboard › publish › Distillation
4b4378f3-b57d-4406-b9aa-a0fbfcff9dca["lore_tm_v1_C6jUELxtCr06vft_C0Pd4uNx0YcdvieNwaQ7-Et0Qvg"]
Date: Aug 27, 2026
src/publish/__tests__/authorize-approval.js imports afterEach, describe, expect, test, and vi from vitest, imports fs, and requires getAutoApprovedRepositories and main from ../authorize-approval.js.src/publish/__tests__/authorize-approval.js snapshots originalEnvironment = { ...process.env }; its afterEach restores process.env, calls vi.restoreAllMocks(), and calls vi.resetModules().src/publish/__tests__/authorize-approval.js defines runAuthorization({ actor, issueTitle, response }), sets GITHUB_OUTPUT to /tmp/github-output, sets APPROVAL_TOKEN, APPROVAL_ACTOR, and APPROVAL_ISSUE_TITLE, mocks fs.appendFileSync and global.fetch, awaits main() and a call to appendFileSync, then returns { appendFileSync, fetch: global.fetch }.loads exact release paths from the auto-approval allowlist mocks fs.readFileSync to return getsentry/sentry-javascript\ngetsentry/objectstore/clients\n and expects getAutoApprovedRepositories() to equal new Set(["getsentry/sentry-javascript", "getsentry/objectstore/clients"]).writes authorization after a successful GitHub permission lookup invokes runAuthorization for actor contractor and title publish: getsentry/sentry-javascript@10.0.0, with a successful mocked response whose JSON is { role_name: "write" }; it expects a permission request to https://api.github.com/repos/getsentry/sentry-javascript/collaborators/contractor/permission with an Authorization Bearer header, and expects fs.appendFileSync("/tmp/github-output", "authorized=true\n").fails closed when GitHub cannot return a permission sets GITHUB_OUTPUT, APPROVAL_TOKEN, APPROVAL_ACTOR = "contractor", and APPROVAL_ISSUE_TITLE = "publish: getsentry/sentry-javascript@10.0.0"; mocks global.fetch as { ok: false, status: 404 }; expects main() to reject with Could not retrieve contractor's permission for getsentry/sentry-javascript: GitHub returned 404, with neither console.error nor fs.appendFileSync called.