Summary
There are no integration tests for the Ktor routes. Ktor provides a testApplication engine that runs the full stack in-memory without starting a real HTTP server.
What to add
- Add
ktor-server-test-host to testImplementation dependencies
- Create
RoutesTest.kt:
GET /api/health returns 200 when cache is ready
GET /api/search?postcode=SW1A1AA&radius=5 returns station list
GET /api/search without postcode returns 400
GET /api/search?postcode=INVALID returns appropriate error
- Use
MockDataCache that bypasses UK Gov API calls
Workstream: WS2 Phase 2B
Summary
There are no integration tests for the Ktor routes. Ktor provides a
testApplicationengine that runs the full stack in-memory without starting a real HTTP server.What to add
ktor-server-test-hosttotestImplementationdependenciesRoutesTest.kt:GET /api/healthreturns 200 when cache is readyGET /api/search?postcode=SW1A1AA&radius=5returns station listGET /api/searchwithout postcode returns 400GET /api/search?postcode=INVALIDreturns appropriate errorMockDataCachethat bypasses UK Gov API callsWorkstream: WS2 Phase 2B