mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
- shared build_router() (lib) so main + tests exercise identical wiring - tests/common: spins the real router + AppState against TEST_DATABASE_URL; self-skips when unset (cargo test stays green without a DB). Deterministic, non-secret test JWT/peppers; ephemeral generated identities only — no funded or sensitive wallet seeds (those stay in a separate gitignored L3 harness). - tests/db_queries: validates migrations + db layer against real Postgres (peppered identity lookups, UNIQUE->409, session create/lookup/revoke, key upsert/list/delete, restore-attempt counts). - tests/auth_flow: HTTP flows through the real router (health, auth gate, refresh rotation + old-token revocation, username set+lookup, key register+ fetch, NIP-05 directory). - CI: new integration job with an ephemeral postgres:16 service. - 82 tests total (69 unit + 13 integration), all green against live PG. Complements the monorepo's client-side suite (it tests the wire format the client sends; the client tests the wallet side); mirrors its secret-handling (env-driven, gitignored). Mirrors the L0-L5 tiering from docs/engineering.
14 lines
618 B
Bash
14 lines
618 B
Bash
# Integration-test configuration (L1, fundless).
|
|
#
|
|
# Set TEST_DATABASE_URL to a throwaway Postgres database; the harness runs the
|
|
# migrations into it and exercises the real router + db layer. With it unset,
|
|
# integration tests self-skip and only the in-crate unit tests run.
|
|
#
|
|
# The harness sets its own deterministic, NON-SENSITIVE test secrets (JWT/peppers)
|
|
# internally — do not put real secrets or funded wallet seeds here.
|
|
#
|
|
# Local example (socket auth):
|
|
# createdb smirk_backend_core_test
|
|
# TEST_DATABASE_URL="postgresql:///smirk_backend_core_test?host=/var/run/postgresql" cargo test
|
|
TEST_DATABASE_URL=
|