fix routes

This commit is contained in:
Frederik Spirgi
2026-09-23 10:37:05 +02:00
parent c56b2c4058
commit e7e2ef7543
6 changed files with 32 additions and 26 deletions
+8 -2
View File
@@ -1017,7 +1017,7 @@ test("public pages, workspace guards, and legacy chat links have distinct destin
assert.match(await home.text(), /What would you like to do/);
const chat = await fetch(server.baseUrl + "/app/chats/new", {headers: jar.headers()});
const html = await chat.text();
assert.ok(html.includes('src="/script.js'));
assert.ok(html.includes('src="/js/script.js'));
assert.ok(!html.includes('id="loginForm"'));
assert.deepEqual((await request(server.baseUrl, "/chats", {jar})).json.chats, [], "home and chat pages do not create chats on GET");
await request(server.baseUrl, "/logout", {method: "POST", body: {}, jar});
@@ -1071,7 +1071,7 @@ test("page headers share navigation and keep session markup private", async () =
test("frontend scripts and styles revalidate across deployments", async () => {
const server = await startTestServer({config: {staticMaxAge: "1h"}});
try {
for (const asset of ["/script.js?v=20260909-account-controls", "/app/dom.js?v=20260909-account-controls", "/pages.css?v=20260909-account-controls"]) {
for (const asset of ["/js/script.js?v=20260909-account-controls", "/js/dom.js?v=20260909-account-controls", "/css/pages.css?v=20260909-account-controls"]) {
const response = await fetch(server.baseUrl + asset);
assert.equal(response.status, 200);
assert.equal(response.headers.get("cache-control"), "no-cache");
@@ -1079,5 +1079,11 @@ test("frontend scripts and styles revalidate across deployments", async () => {
assert.ok(etag);
await response.text();
}
for (const entrypoint of ["/js/script.js", "/js/settings.js", "/js/market.js"]) {
const response = await fetch(server.baseUrl + entrypoint);
assert.equal(response.status, 200);
assert.doesNotMatch(await response.text(), /from\s+["']\.\/js\//, `${entrypoint} must not resolve dependencies below /js/js`);
}
} finally { await server.close(); }
});
+2 -2
View File
@@ -1,7 +1,7 @@
import test from "node:test";
import assert from "node:assert/strict";
import {readFile} from "node:fs/promises";
import {regenerateInline} from "../public/app/regeneration.js";
import {regenerateInline} from "../public/js/regeneration.js";
class Element {
constructor(tag = "div") {
@@ -86,7 +86,7 @@ test("inline renderer streams in place, follows only nearby output, commits or r
});
test("Regenerate uses inline activity and never reloads or appends a chat message", async () => {
const source = await readFile(new URL("../public/script.js", import.meta.url), "utf8");
const source = await readFile(new URL("../public/js/script.js", import.meta.url), "utf8");
const regenerate = source.slice(source.indexOf("async function retryLatestAssistantMessage"), source.indexOf("async function switchResponseVersion"));
assert.match(regenerate, /setLoadingState\(true, false\)/);
assert.match(regenerate, /regenerateInline/);