Skip to content

Commit ec7a892

Browse files
committed
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 <noreply@anthropic.com>
1 parent 9c18422 commit ec7a892

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/webapp/test/archiveBranchRedirect.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// paginated or filtered branches list must land back on that exact page instead
33
// of a bare branches path that resets the list to page 1.
44

5-
import { describe, expect, it, vi } from "vitest";
5+
import { beforeEach, describe, expect, it, vi } from "vitest";
66
import { action } from "~/routes/resources.branches.archive";
77

88
vi.mock("~/services/session.server", () => ({
@@ -37,6 +37,10 @@ async function archive(redirectPath: string) {
3737
}
3838

3939
describe("archiving a branch returns to the page it was started from", () => {
40+
beforeEach(() => {
41+
archiveSucceeds.value = true;
42+
});
43+
4044
it("preserves the query string on success", async () => {
4145
const response = await archive(LIST_PATH);
4246

@@ -45,8 +49,8 @@ describe("archiving a branch returns to the page it was started from", () => {
4549

4650
it("preserves the query string on failure", async () => {
4751
archiveSucceeds.value = false;
52+
4853
const response = await archive(LIST_PATH);
49-
archiveSucceeds.value = true;
5054

5155
expect(response.headers.get("Location")).toBe(LIST_PATH);
5256
});

0 commit comments

Comments
 (0)