fix test: stub PAPERCLIP_DEV_API_KEY before each cancel-poll test

The cancel-poll test sets PAPERCLIP_API_KEY='test-key' but the actual
PAPERCLIP_DEV_API_KEY was leaking through from the harness environment.
Since execute.ts prefers PAPERCLIP_DEV_API_KEY over PAPERCLIP_API_KEY,
the poll was sending the real dev key instead of 'test-key'.

Fix: add beforeEach to set PAPERCLIP_DEV_API_KEY='test-key', and afterEach
to clean both env vars.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 23:40:41 +00:00
parent 1bad618b29
commit 4fcd3b4547
+5
View File
@@ -879,11 +879,16 @@ describe("execute — log dedup (waitForPod status dedup)", () => {
describe("execute — external cancel polling", () => {
const KEEPALIVE_MS = 15_000;
beforeEach(() => {
process.env.PAPERCLIP_DEV_API_KEY = "test-key";
});
afterEach(() => {
vi.useRealTimers();
vi.unstubAllGlobals();
delete process.env.PAPERCLIP_API_URL;
delete process.env.PAPERCLIP_API_KEY;
delete process.env.PAPERCLIP_DEV_API_KEY;
});
it("returns errorCode=cancelled and deletes job when issue status is cancelled", async () => {