wbxcallprov/test/setup.js
jmcqueen 6de5392e90
Some checks are pending
CI / verify (push) Waiting to run
Add node:test suite and Gitea Actions CI
- 30-test suite (node --test, no framework) covering the exact functions
  that have regressed in previous rounds:
    * parseStoreArg / parseStoreNumber / storeEmail (helpers)
    * greetingForBrand (brand fallback)
    * formatE911Address / formatSuite (google response reducer)
    * parseNextLink (RFC-5988 pagination — now exported)
    * runStep success / non-critical / critical / no-bot paths
- test/setup.js stubs required env vars so any src/ module can be
  imported cleanly; loaded via --import once per test process
- npm run test wired up; directory form works on Node 20 + 22
- .gitea/workflows/ci.yml runs lint + format:check + test on push/PR
  to main, on Node 22 to match the runtime image
- Exclude test/ and .gitea/ from the Docker build context
- Exclude docker/ from bot Prettier scope (remote-agent is its own
  sub-project with its own tooling)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:07:02 -04:00

27 lines
1.1 KiB
JavaScript

// Loaded before every test file via `node --test --import ./test/setup.js`.
//
// Its only job is to satisfy the `required(...)` env checks in src/config.js
// so we can `import` any module in the tree from a test file without
// module-load blowing up. None of these values are ever used at rest — the
// tests exercise pure functions, and any code path that would actually make
// a network call is either mocked or not exercised by the test suite.
//
// If you add a new `required('FOO')` call in src/config.js, add a stub here.
const dummy = {
WEBEX_BOT_TOKEN: 'test-bot-token',
WEBEX_SVC_CLIENT_ID: 'test-svc-client-id',
WEBEX_SVC_CLIENT_SECRET: 'test-svc-client-secret',
TWILIO_ACCOUNT_SID: 'test-twilio-sid',
TWILIO_AUTH_TOKEN: 'test-twilio-token',
SIW_USERNAME: 'test-siw-user',
SIW_PASSWORD: 'test-siw-password',
GOOGLE_API_KEY: 'test-google-key',
WS_TOKEN: 'test-ws-token',
};
for (const [key, value] of Object.entries(dummy)) {
if (process.env[key] === undefined || process.env[key] === '') {
process.env[key] = value;
}
}