fix(POSTV1-02): 修复便携网页静态资源类型
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run

This commit is contained in:
suyx
2026-08-05 14:07:42 +08:00
parent a7f62adad4
commit f7cac5dabf
2 changed files with 33 additions and 2 deletions
+13 -1
View File
@@ -138,7 +138,19 @@ test("portable package serves the product and keeps SQLite data across API resta
assert.ok(cookie);
const page = await fetch(`http://127.0.0.1:${port}/app`, { headers: { host: `127.0.0.1:${port}`, cookie, "sec-ch-ua": '"Google Chrome";v="150"' } });
assert.equal(page.status, 200);
assert.match(await page.text(), /<div id="root"><\/div>/);
const pageHtml = await page.text();
assert.match(pageHtml, /<div id="root"><\/div>/);
const scriptPath = pageHtml.match(/<script[^>]+src="([^"]+)"/)?.[1];
const stylesheetPath = pageHtml.match(/<link[^>]+href="([^"]+)"/)?.[1];
assert.ok(scriptPath);
assert.ok(stylesheetPath);
const assetHeaders = { host: `127.0.0.1:${port}`, cookie, "sec-ch-ua": '"Google Chrome";v="150"' };
const script = await fetch(`http://127.0.0.1:${port}${scriptPath}`, { headers: assetHeaders });
const stylesheet = await fetch(`http://127.0.0.1:${port}${stylesheetPath}`, { headers: assetHeaders });
assert.equal(script.status, 200);
assert.match(script.headers.get("content-type") ?? "", /^(?:application|text)\/javascript\b/);
assert.equal(stylesheet.status, 200);
assert.match(stylesheet.headers.get("content-type") ?? "", /^text\/css\b/);
assert.ok(existsSync(join(dataRoot, "db", "dada.sqlite3")));
await verifyWorkerStartup(configPath);
} finally {