sendi/tests/setup.ts
jmcqueen d0a0dda2b8 Initial commit: Sendi 2.0 SMS gateway (Webex + Twilio)
Sendi is a Webex to Twilio SMS gateway written in TypeScript that runs
directly on Node 22.18+ via native type-stripping (no bundler/transpiler).
Each Webex space represents one external SMS contact; inbound MMS is
proxied both ways, with delivery-status cards for outbound sends.

Highlights:
- Express 5 HTTP surface for Twilio /sms and /callback (signature-validated)
- webex-node-bot-framework in websocket transport mode for bot control plane
- Prisma 6 + SQLite via better-sqlite3 driver adapter
- Zod-validated env with fail-fast startup and pino secret redaction
- Pino logging: pretty in dev, structured JSON in prod
- 13 vitest unit tests (phone normalization, Twilio signature validation,
  card action dispatch)
- Native --require preload patches Node 22's read-only globalThis.navigator
  so @webex/internal-media-core (transitive) can load

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 11:10:44 -04:00

15 lines
686 B
TypeScript

// tests/setup.ts
// Inject dummy environment values BEFORE any application code runs, so that
// importing `../src/config/env` succeeds without a real .env on disk.
process.env.NODE_ENV = 'test';
process.env.LOG_LEVEL = 'silent';
process.env.PORT = '13337';
process.env.WEBEX_TOKEN = 'test-token';
process.env.WEBEX_BOT_EMAIL = 'testbot@webex.bot';
process.env.WEBEX_PUBLIC_URL = 'https://example.test/sendi';
process.env.CALLBACK_URL = 'https://example.test/sendi/callback';
process.env.TWILIO_ACCOUNT_SID = 'AC' + '0'.repeat(32);
process.env.TWILIO_AUTH_TOKEN = 'test-auth-token';
process.env.TWILIO_DEFAULT_FROM = '+15551234567';
process.env.DATABASE_URL = 'file:./prisma/dev.db';