Skip to content
18 linesCodeBlameRaw
1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { stuckTarget } from "./stuck.ts";
5
6const location = { pathname: "/flagon-io/g1t/pulls", search: "?state=closed", hash: "#top" };
7
8test("an idle page has nothing to retry", () => {
9 assert.equal(stuckTarget({ state: "idle" }), null);
10});
11
12test("a navigation still loading is retried at its full address", () => {
13 assert.equal(stuckTarget({ state: "loading", location }), "/flagon-io/g1t/pulls?state=closed#top");
14});
15
16test("a form still being sent is never sent again", () => {
17 assert.equal(stuckTarget({ state: "submitting", location }), null);
18});