Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:3vwjk71z5u is past its budget: trevato/forge: "a page that answers 200 names its canonical address, equal to og:url; a 404 names none" failed on 3 pul… #8238
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/8233-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork
1 file
changed +7
−3
test/forge-webspec.test.ts +7 −3
| @@ -24,6 +24,9 @@ quietLogs(); | ||
| 24 | 24 | |
| 25 | 25 | const PATHS = ["/", "/signin", "/signup", "/explore", "/alice/notes", "/alice/notes/issues", "/alice/notes/issues/1", "/alice/notes/tree/main", "/alice/notes/blob/main/a.txt"]; |
| 26 | 26 | |
| 27 | /** A person's browser: a request with no User-Agent counts against the crawl budget (#8129), which shrinks while the check machine is loaded, so these tests are never crawlers. */ | |
| 28 | const BROWSER = { "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/120.0 Safari/537.36" }; | |
| 29 | ||
| 27 | 30 | const CACHING = "https://specification.website/#caching"; |
| 28 | 31 | |
| 29 | 32 | /** `check path` -> [section, why it stands]. Every one is expected on every page it names; one fixed fails the test, one new fails it too. */ |
| @@ -90,6 +93,7 @@ afterAll(async () => { | ||
| 90 | 93 | const through = (signedIn: boolean) => async (input: string, init?: RequestInit) => { |
| 91 | 94 | const request = new Request(input, init); |
| 92 | 95 | if (signedIn) request.headers.set("cookie", cookie); |
| 96 | if (!request.headers.has("user-agent")) request.headers.set("user-agent", BROWSER["user-agent"]); | |
| 93 | 97 | if (!request.headers.has("accept-encoding")) request.headers.set("accept-encoding", "br, gzip"); |
| 94 | 98 | const response = await compress(request, await http.handle(request)).then(securityFloor); |
| 95 | 99 | const encoding = response.headers.get("content-encoding"); |
| @@ -120,7 +124,7 @@ test("the owner's signed-in pages raise exactly the findings named in KNOWN_SIGN | ||
| 120 | 124 | |
| 121 | 125 | test("a page that answers 200 names its canonical address, equal to og:url; a 404 names none", async () => { |
| 122 | 126 | const head = async (path: string) => { |
| 123 | const res = await http.handle(new Request(`http://forge.test${path}`)); | |
| 127 | const res = await http.handle(new Request(`http://forge.test${path}`, { headers: BROWSER })); | |
| 124 | 128 | return { status: res.status, html: await res.text() }; |
| 125 | 129 | }; |
| 126 | 130 | for (const path of ["/", "/explore", "/alice/notes", "/explore?x=1"]) { |
| @@ -138,12 +142,12 @@ test("a page that answers 200 names its canonical address, equal to og:url; a 40 | ||
| 138 | 142 | |
| 139 | 143 | test("the walked signed-in pages answer 200 for the owner", async () => { |
| 140 | 144 | for (const path of SIGNED_IN) { |
| 141 | expect((await http.handle(new Request(`http://forge.test${path}`, { headers: { cookie } }))).status).toBe(200); | |
| 145 | expect((await http.handle(new Request(`http://forge.test${path}`, { headers: { cookie, ...BROWSER } }))).status).toBe(200); | |
| 142 | 146 | } |
| 143 | 147 | }); |
| 144 | 148 | |
| 145 | 149 | test("the walked repository pages exist", async () => { |
| 146 | 150 | for (const path of ["/alice/notes", "/alice/notes/issues", "/alice/notes/issues/1"]) { |
| 147 | expect((await http.handle(new Request(`http://forge.test${path}`))).status).toBe(200); | |
| 151 | expect((await http.handle(new Request(`http://forge.test${path}`, { headers: BROWSER }))).status).toBe(200); | |
| 148 | 152 | } |
| 149 | 153 | }); |
new above
offline