You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue [Feature] Create comprehensive test helpers for ESM mock patterns
Tier: 🟡 Medium
Description:
Problem: Multiple test files independently define the same mock objects for stellar.service.js, users.model.js, telemetry.model.js, infra/socket/io.js, etc. Each mock must include ALL named exports from the real module or ESM resolution fails. This has caused 48+ test failures across the suite because individual test files forget to include exports like getStellarExplorerUrl, UserRole, Telemetry, or bulkIngestTelemetry.
Implementation: Create a tests/helpers/mocks.ts file that exports complete, reusable mock factories:
createStellarServiceMock() — returns all 4 exports
createSocketIoMock() — returns all 5 socket functions
Each factory returns a complete mock object. Test files import and use these factories, ensuring no exports are forgotten.
Dependencies:
Depends on None
Acceptance Criteria:
tests/helpers/mocks.ts exports factory functions for all commonly-mocked modules.
Each factory returns ALL named exports from the real module.
At least 3 test files are migrated to use the helpers as examples.
Documentation in the helpers file explains the pattern.
Testing Requirements:
All migrated test files pass with the new helpers.
Run npm test to confirm no regressions.
PR Checklist:
Branch is named conventionally (e.g., feature/issue-XX-test-mock-helpers).
npm run lint and npm run build pass with zero warnings.
Screenshot of passing Jest terminal logs is attached to the PR.
Domain: Testing
Issue [Feature] Create comprehensive test helpers for ESM mock patterns
Tier: 🟡 Medium
Description:
stellar.service.js,users.model.js,telemetry.model.js,infra/socket/io.js, etc. Each mock must include ALL named exports from the real module or ESM resolution fails. This has caused 48+ test failures across the suite because individual test files forget to include exports likegetStellarExplorerUrl,UserRole,Telemetry, orbulkIngestTelemetry.tests/helpers/mocks.tsfile that exports complete, reusable mock factories:createStellarServiceMock()— returns all 4 exportscreateUsersModelMock()— returnsUserModel,OrganizationModel,UserRole,OrganizationTypecreateTelemetryModelMock()— returnsTelemetry,TelemetryAnchorStatuscreateSocketIoMock()— returns all 5 socket functionsEach factory returns a complete mock object. Test files import and use these factories, ensuring no exports are forgotten.
Dependencies:
Acceptance Criteria:
tests/helpers/mocks.tsexports factory functions for all commonly-mocked modules.Testing Requirements:
npm testto confirm no regressions.PR Checklist:
feature/issue-XX-test-mock-helpers).npm run lintandnpm run buildpass with zero warnings.