Tests
Unit tests
npm test # once (mandatory before every finished change)
npm run test:watch # during development
npx tsc --noEmit # type check
The tests live in test/core/ (core) and test/<feature>/ (per feature), sample data in test/fixtures/. They need no hardware, root or network and never wait on real timers: time is controlled through injectable clocks (now), delays through injectable functions (e.g. failureDelay). Parsers, generators (smb.conf, exports, systemd units), rules and services get unit tests; services are tested with their mock system.
Mock mode
npm run dev:mock # http://localhost:3000, login admin / admin
The mock simulates the example hardware completely, so the whole interface can be used on Windows as well. To test the production build:
npm run build
BUNKERBOX_MOCK=1 BUNKERBOX_DATA_DIR=/tmp/bb-data npm start
Rules
- Never test against production systems. Destructive operations (pools, datasets, users) only in the mock or on a dedicated test VM with throwaway disks.
- Waits in tests are capped at 2 minutes; no long
sleep.