Files
zeekay 8e5acce5f7 Untrack the plugin's test scratch and name /v1/ in the connection help
0a306bf348 picked up nodejs/.tmp, which jest.setup-env.ts writes on
every run; it is ignored now.  The connection endpoint's example path
said api/projects/..., which this app no longer serves.

Claude-Session: https://claude.ai/code/session_011i2AG9nwpiKUCVxAdDzYuU
2026-09-29 18:49:41 -07:00
..
2026-09-08 23:21:56 -07:00

Insights Node.js services

Node.js services for Insights: ingestion pipeline, CDP, session recording, and more.

Running tests

Tests run against dedicated test databases, never the dev stack's databases:

Store Test database Dev database (never used by tests)
Postgres (common) test_insights insights
Postgres (persons) test_persons insights_persons
Postgres (behavioral cohorts) test_behavioral_cohorts behavioral_cohorts
Postgres (cyclotron) test_cyclotron, test_cyclotron_node cyclotron
Datastore insights_test default

These are the defaults whenever NODE_ENV=test, which jest.setup-env.ts forces for every jest run. The schema is owned by Django and rust migrations, so the test databases must be created before the first run:

# From the repo root, with the dev stack's Postgres/Datastore/Kafka/Redis running:
pnpm --filter=@hanzo/nodejs setup:test

This runs Django's setup_test_environment (creates test_insights and the Datastore insights_test schema) plus the rust migrations for the persons, behavioral cohorts, and cyclotron test databases. Then:

cd nodejs
pnpm test                      # full suite (sharded in CI)
pnpm jest tests/path/to.test.ts  # single file

Destructive test helpers refuse to run against a database without test in its name — see tests/helpers/database-guard.ts. The guard's error message explains how to fix a misconfigured environment.