Split src/http/app.test.ts into one file per concern, and reset the reading-cost trend #194
@@ -1818,8 +1818,7 @@ src/ The app — strict tsc, no build step. *.test.ts sit beside
|
|||||||
server.ts Entry point; config.ts env loader; logger.ts structured log + trace span + tracedFetch
|
server.ts Entry point; config.ts env loader; logger.ts structured log + trace span + tracedFetch
|
||||||
*.test.ts Guards with no source counterpart (compose/kratos/keto/hydra/postgres/ci-gate/function-limits)
|
*.test.ts Guards with no source counterpart (compose/kratos/keto/hydra/postgres/ci-gate/function-limits)
|
||||||
http/ Request pipeline: app.ts (createApp), builtin-routes, context, body, cookie,
|
http/ Request pipeline: app.ts (createApp), builtin-routes, context, body, cookie,
|
||||||
static, safe-url (safeUrl + localPath), security-headers; app*.test.ts: one per concern
|
static, safe-url (safeUrl + localPath), security-headers
|
||||||
over shared fixtures in app-harness.ts
|
|
||||||
auth/ Identity + the session-JWT hot path: jwt · jwt-middleware · jwks · gen-jwks (CLI) ·
|
auth/ Identity + the session-JWT hot path: jwt · jwt-middleware · jwks · gen-jwks (CLI) ·
|
||||||
login · guards · csrf · denylist · flow-view · oauth-login · oauth-consent ·
|
login · guards · csrf · denylist · flow-view · oauth-login · oauth-consent ·
|
||||||
routes · bootstrap, and the Ory REST clients (kratos-public/admin, keto, hydra,
|
routes · bootstrap, and the Ory REST clients (kratos-public/admin, keto, hydra,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Built-in OAuth2 clients admin screen: the pure view-model + Hydra-payload builders. A client
|
// Built-in OAuth2 clients admin screen: the pure view-model + Hydra-payload builders. A client
|
||||||
// is an Ory Hydra OAuth2 client (apps that log in *through* us); writes go only to Hydra. The
|
// is an Ory Hydra OAuth2 client (apps that log in *through* us); writes go only to Hydra. The
|
||||||
// HTTP routing/gate/CSRF + live Hydra calls (incl. the one-time secret) are exercised in app-admin.test.ts.
|
// HTTP routing/gate/CSRF + live Hydra calls (incl. the one-time secret) are exercised in src/http/app-admin.test.ts.
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// The pure half of permission granting: what a submitted checkbox set changes, and the picker the
|
// The pure half of permission granting: what a submitted checkbox set changes, and the picker the
|
||||||
// two screens render from it. The Keto writes and the HTTP round trip are covered in app-admin.test.ts.
|
// two screens render from it. The Keto writes and the HTTP round trip are covered in src/http/app-admin.test.ts.
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import type { PermissionDecl } from "@plainpages/plugin-api";
|
import type { PermissionDecl } from "@plainpages/plugin-api";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Built-in Groups admin screen: the pure view-model + Keto-tuple builders. A group is a
|
// Built-in Groups admin screen: the pure view-model + Keto-tuple builders. A group is a
|
||||||
// Keto subject set (Group:<name>#members); membership tuples carry users (subject_id) or nested
|
// Keto subject set (Group:<name>#members); membership tuples carry users (subject_id) or nested
|
||||||
// groups (subject_set). The HTTP routing/gate/CSRF + live Keto/Kratos calls are exercised over
|
// groups (subject_set). The HTTP routing/gate/CSRF + live Keto/Kratos calls are exercised over
|
||||||
// HTTP in app-admin.test.ts.
|
// HTTP in src/http/app-admin.test.ts.
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Shared fixtures for the app.*.test.ts files: a signing key for session JWTs, an app starter,
|
|
||||||
// and stub Ory clients.
|
|
||||||
import { generateKeyPairSync, sign, type JsonWebKey } from "node:crypto";
|
import { generateKeyPairSync, sign, type JsonWebKey } from "node:crypto";
|
||||||
import type { AddressInfo } from "node:net";
|
import type { AddressInfo } from "node:net";
|
||||||
import type { TestContext } from "node:test";
|
import type { TestContext } from "node:test";
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ test("a plugin view renders the native chrome; its forms are CSRF-guarded via ct
|
|||||||
});
|
});
|
||||||
|
|
||||||
// JWT middleware: a verified session cookie populates ctx.user/permissions, which the gate reads.
|
// JWT middleware: a verified session cookie populates ctx.user/permissions, which the gate reads.
|
||||||
// The key + mintJwt + session() helper live in app-harness.ts.
|
|
||||||
test("a verified session JWT authorizes a permission-gated route; no cookie / expired token → sign in", async (t) => {
|
test("a verified session JWT authorizes a permission-gated route; no cookie / expired token → sign in", async (t) => {
|
||||||
const app = createApp({ jwks: staticJwks([ecJwk]), plugins: [demoPlugin] });
|
const app = createApp({ jwks: staticJwks([ecJwk]), plugins: [demoPlugin] });
|
||||||
await new Promise<void>((r) => app.listen(0, r));
|
await new Promise<void>((r) => app.listen(0, r));
|
||||||
|
|||||||
Reference in New Issue
Block a user