Skip to content

Expand test coverage to 43 tests across all layers#7

Open
Valamorde wants to merge 1 commit into
refactor/phase-6-restructurefrom
refactor/phase-7-test-coverage
Open

Expand test coverage to 43 tests across all layers#7
Valamorde wants to merge 1 commit into
refactor/phase-6-restructurefrom
refactor/phase-7-test-coverage

Conversation

@Valamorde
Copy link
Copy Markdown
Owner

Summary

Adds 23 new tests (up from 20) to cover every previously untested handler, service action, and repository. Coverage now spans all layers of the codebase.

New test files:

File What it covers
tests/lambda/keepalive.test.ts Keepalive Lambda returns 200 immediately
tests/lambda/sendmessage.test.ts Router: keepalive short-circuit, cloud flag gating, switch_scene forward suppression
tests/handlers/messages/playerjoin.test.ts Sends fetchscene with stored/null player scene ID
tests/handlers/messages/switch-scene.test.ts DM and player scene persistence, fetchscene broadcast
tests/handlers/messages/draw.test.ts Draw data persisted with correct objectId
tests/handlers/services/getScene.test.ts Assembles scene with tokens, fog, and draw from sub-items
tests/handlers/services/migrate.test.ts Batch-writes all scene sub-items; generates IDs for scenes missing one
tests/handlers/services/exportScenes.test.ts Assembles multi-scene export; handles empty campaign
tests/repositories/connection.test.ts put (DM/player objectId, TTL), deleteById, queryByCampaign, queryByType, findByConnectionId GSI

All tests mock only the DynamoDB and ApiGateway clients — no business logic is stubbed. Tests assert on the specific commands, keys, and payloads that reach AWS, not on internal implementation details.

Test plan

  • pnpm test — 43 tests pass across 17 files

Add 23 new tests covering previously untested lambda entry points,
message handlers (playerjoin, switch-scene, draw), service actions
(getScene, migrate, exportScenes), and the connection repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant