Describe the solution you'd like
Several important source modules currently do not have corresponding unit test files under test/unit/. These modules contain core application logic, external integrations, financial operations, and database behavior, so missing test coverage increases the risk of regressions.
The following modules should have dedicated unit tests added:
| Module |
Why test coverage is needed |
src/adapters/redis-adapter.ts |
A Redis-related bug, reported in Issue 1, went undetected because this adapter has no unit tests. |
src/adapters/web-socket-adapter.ts |
Contains complex WebSocket message dispatching, connection handling, heartbeat, and error-handling logic. |
src/adapters/web-socket-server-adapter.ts |
Handles broadcasting and connection lifecycle behavior, which should be tested independently. |
src/services/payments-service.ts |
Contains financial logic such as invoice confirmation and balance-related operations. These flows should be protected with tests. |
src/utils/settings.ts |
Includes file watching, YAML configuration merging, default values, and fallback behavior. |
src/handlers/request-handlers/root-request-handler.ts |
Responsible for constructing the NIP-11 document and handling root-level requests. |
src/repositories/event-repository.ts |
Contains database query-building and event ordering logic that should be verified with unit tests. |
Expected work
- Add corresponding test files under
test/unit/ for each module listed above.
- Cover normal behavior, edge cases, and failure scenarios where applicable.
- Mock external dependencies such as Redis, WebSocket clients/servers, file system access, payment providers, and database connections.
- Ensure tests verify important business logic, especially payment confirmation, balance updates, event ordering, and configuration fallback behavior.
- Keep the test structure and naming consistent with the existing test suite.
Acceptance criteria
- Each listed source module has at least one corresponding unit test file in
test/unit/.
- Core methods and important branches are covered.
- External services are mocked and tests do not require real Redis, WebSocket servers, payment services, or databases.
- All existing tests continue to pass.
- New tests can be run successfully in the Linux Docker development environment.
System information
- OS: Linux
- Environment: Docker
- Version: v2.1.0
Describe the solution you'd like
Several important source modules currently do not have corresponding unit test files under
test/unit/. These modules contain core application logic, external integrations, financial operations, and database behavior, so missing test coverage increases the risk of regressions.The following modules should have dedicated unit tests added:
src/adapters/redis-adapter.tssrc/adapters/web-socket-adapter.tssrc/adapters/web-socket-server-adapter.tssrc/services/payments-service.tssrc/utils/settings.tssrc/handlers/request-handlers/root-request-handler.tssrc/repositories/event-repository.tsExpected work
test/unit/for each module listed above.Acceptance criteria
test/unit/.System information