From ec7a892e1c341ec80f121a6dcce7993315954105 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 19 Aug 2026 19:03:58 +0000 Subject: [PATCH] test(webapp): reset the archive stub flag in beforeEach The failure case toggled a module-level flag and reset it inline, so any early exit between the toggle and the reset would leave the stub in its failure state for the rest of the file. Reset it in beforeEach instead, matching dashboardAgentClientMetadata.test.ts and metadataRouteReplicaLag.guard.test.ts. Co-Authored-By: Claude --- apps/webapp/test/archiveBranchRedirect.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/webapp/test/archiveBranchRedirect.test.ts b/apps/webapp/test/archiveBranchRedirect.test.ts index 5a7677c97..f096376e7 100644 --- a/apps/webapp/test/archiveBranchRedirect.test.ts +++ b/apps/webapp/test/archiveBranchRedirect.test.ts @@ -2,7 +2,7 @@ // paginated or filtered branches list must land back on that exact page instead // of a bare branches path that resets the list to page 1. -import { describe, expect, it, vi } from "vitest"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import { action } from "~/routes/resources.branches.archive"; vi.mock("~/services/session.server", () => ({ @@ -37,6 +37,10 @@ async function archive(redirectPath: string) { } describe("archiving a branch returns to the page it was started from", () => { + beforeEach(() => { + archiveSucceeds.value = true; + }); + it("preserves the query string on success", async () => { const response = await archive(LIST_PATH); @@ -45,8 +49,8 @@ describe("archiving a branch returns to the page it was started from", () => { it("preserves the query string on failure", async () => { archiveSucceeds.value = false; + const response = await archive(LIST_PATH); - archiveSucceeds.value = true; expect(response.headers.get("Location")).toBe(LIST_PATH); });