# NTS integration tests (unified host)

**Date:** 2026-03-17

## Summary

First integration tests for dynamo-nts were added to cover the unified host behaviour (static client, API base path, socket path, default 404 page).

## Additions

- **Integration mock:** [src/_modules/mock/app-integration-test.mock.ts](../src/_modules/mock/app-integration-test.mock.ts)  
  `DyNTS_AppIntegrationTest_Mock` extends `DyNTS_AppWbMock_Mock`, runs without DB, and provides:
  - `getAppParams()` with no `dbName`/`dbUri`
  - `getPortSettings()` with `httpPort: 54536`, `socketPath: '/socket'`
  - `getApiBasePath()` returning `'/api'`
  - `getStaticClientSettings()` returning `root` from static property `integrationStaticRoot` (set by the spec), no `fallbackPath` (so 404 uses default HTML)

- **Integration spec:** [src/_modules/socket/app-extended.integration.spec.ts](../src/_modules/socket/app-extended.integration.spec.ts)  
  - Uses a temp dir for static files and starts the app in `beforeAll`; stops app and removes temp dir in `afterAll`.
  - Timeout set to 15s for this suite.
  - Tests: app starts (`started === true`), GET non-existent path → 404 + default “Page not found” HTML, GET `/index.html` → 200 + static content, GET `/api/test-0/test-base` and `/api/test-0/test-simple` → 200 with expected body.

## Conventions

- Same test style as existing NTS specs: Jasmine, `*.spec.ts`, run via `pnpm test` (build + jasmine).
- Port **54536** must be free when the integration spec runs (used by the mock app).
