Skip to content

Test Scripts

The scripts/test/ directory contains cross-platform and integration test suites.

Contract Tests (test/contracts.ts)

Validates that the server API responses match the Dart models in the mobile app.

bash
bun test:contracts
# or directly: bun scripts/test/contracts.ts

Phase 1 (Bun):

  1. Start an in-memory test server
  2. Seed navigation data (location, floor, nodes, edges, token)
  3. Hit navigation API endpoints
  4. Write real JSON responses to mobile/test/fixtures/*.json

Phase 2 (Dart):

  1. Run flutter test test/contract_test.dart in the mobile directory
  2. Dart tests read the fixtures and verify models parse correctly

Binary Smoke Tests (test/binary.sh)

Compiles the server binary for the host architecture, boots it with a minimal config, and verifies key endpoints.

bash
bash scripts/test/binary.sh               # compile + test
bash scripts/test/binary.sh --skip-build  # test existing binary

Steps:

  1. Compile binary for host architecture
  2. Create temp working directory with minimal main.config.json
  3. Start the binary on a random port
  4. Hit endpoints: /version, /, static assets, /login, authenticated routes
  5. Report pass/fail counts

This runs automatically as part of the server build pipeline (build/server.sh).

VM Integration Tests (test/vm.sh)

Full lifecycle test designed to run on a clean Linux VM (Ubuntu/Debian).

bash
sudo bash scripts/test/vm.sh           # run all tests
sudo bash scripts/test/vm.sh --quick   # skip interactive + optional services
sudo bash scripts/test/vm.sh --clean   # remove all artifacts and exit

Tests the complete lifecycle:

  • Installer download and execution
  • Phase 1 install (binary, scripts, default config)
  • Phase 2 setup (service, nginx, cron)
  • CLI commands (config, user, status, selftest)
  • Service management (start, stop, restart)
  • Nginx and cron configuration
  • Update and repair workflows
  • Clean uninstall

Prerequisites:

  • Clean Ubuntu/Debian VM (22.04+)
  • Root access
  • Internet connection (downloads from updates.wantok.cz)

Other Test Commands

Server unit tests and web type checking are run separately:

bash
# Server unit tests
cd server && bun test

# Mobile tests
cd mobile && flutter test

# Web type checking
cd web && bun run typecheck