Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

12 linesCodeBlameRaw
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { BUILD_HEADER, needsBuildRefresh } from "./build-version.ts";
4
5test("old navigation reads switch builds before loaders; writes and ordinary documents do not", () => {
6 const request = (path: string, method = "GET", build = "old") => new Request(`https://g1t.sh${path}`, { method, headers: { [BUILD_HEADER]: build } });
7 assert.equal(needsBuildRefresh(request("/flagon-io/-/home.data"), "new"), true);
8 assert.equal(needsBuildRefresh(request("/flagon-io/-/home.data", "GET", "new"), "new"), false);
9 assert.equal(needsBuildRefresh(request("/flagon-io/-/home.data", "POST"), "new"), false);
10 assert.equal(needsBuildRefresh(request("/flagon-io/-/home"), "new"), false);
11 assert.equal(needsBuildRefresh(new Request("https://g1t.sh/a.data"), "new"), false);
12});