test(acl)(#29): DB-backed integration tests for checkIfPubkeyAllowed
Some checks failed
Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Docker image / build-and-push-image (push) Has been cancelled
Closes the gap flagged in #27 review: the wiring that actually closes #24 (step-4 Token join filtered by liveWhere) was untested — only the pure predicate was. Now covered end-to-end against a throwaway SQLite DB + the real prisma client. Harness (no new dependency; pnpm add is blocked by the nix node_modules hoist pattern): - tests/register-ts.cjs: ts-node (transpile-only) + a CommonJS resolver that maps the app's '.js' ESM-style specifiers to their '.ts' sources. - node:test temp DB via 'prisma db push'; a before() guard refuses to run unless DATABASE_URL points at tests/.tmp/ (never truncates a real DB). - npm run test:integration / test:all. 13 cases incl. the #24 regression guard (expired token -> denied), revoke, connect-off-live-token, override expiry/revoke ignored, deny-beats-grant, kind mismatch, no-KeyUser. Also: acl/index.ts NDK import -> 'import type' (NostrEvent/NIP46Method are type-only) so the ACL module no longer pulls ESM-only NDK at runtime — required for the CommonJS test import, and a correct cleanup besides. Requires the prisma engine env (CI/nix ok; devShell pending #30). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
14e20d50d4
commit
0b9ffe8ca6
5 changed files with 232 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@ config
|
|||
.env
|
||||
.turbo
|
||||
prisma
|
||||
tests/.tmp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue