Move the web application into createApp() so tests can run the real middleware order
index.ts builds the app, runs migrations and starts the schedulers in one go, so nothing could exercise the app without also starting all that. The app itself (middleware order, session store, routers) is now createApp() in app.ts; index.ts keeps the startup work and calls it. No change in behaviour. The test that checks the agent endpoint is mounted ahead of the 100 KB JSON parser reads app.ts instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c70956f78
commit
73b86d88de
3 files changed
+127
-101
No files matched your search
@@ -223,9 +223,9 @@ describe("agent endpoint", () => {
|
||||
const report = (extra: object = {}) => ({ hostname: "agent-host", os_type: "linux", tasks: [], ...extra });
|
||||
|
||||
test("is mounted ahead of the app-wide JSON parser and the session store", () => {
|
||||
const index = readFileSync(join(repoRoot, "server/src/index.ts"), "utf8");
|
||||
const index = readFileSync(join(repoRoot, "server/src/app.ts"), "utf8");
|
||||
const agent = index.indexOf('app.use("/api/agent/report"');
|
||||
assert.ok(agent > 0, "agent route not found in index.ts");
|
||||
assert.ok(agent > 0, "agent route not found in app.ts");
|
||||
assert.ok(agent < index.indexOf("app.use(express.json())"), "the agent route must come before the 100 KB JSON parser");
|
||||
assert.ok(agent < index.indexOf("session({"), "the agent route must come before the session store");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user