| 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; |
| 3 | |
| 4 | import { stuckTarget } from "./stuck.ts"; |
| 5 | |
| 6 | const location = { pathname: "/flagon-io/g1t/pulls", search: "?state=closed", hash: "#top" }; |
| 7 | |
| 8 | test("an idle page has nothing to retry", () => { |
| 9 | assert.equal(stuckTarget({ state: "idle" }), null); |
| 10 | }); |
| 11 | |
| 12 | test("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 | |
| 16 | test("a form still being sent is never sent again", () => { |
| 17 | assert.equal(stuckTarget({ state: "submitting", location }), null); |
| 18 | }); |