Skip to content

[Testing] socket/index.ts reconnection backoff logic has no automated test #839

Description

@RUKAYAT-CODER

Overview

The exponential backoff and reconnection logic in socket/index.ts is untested. Edge cases (max retries exceeded, server rejects reconnect, partial disconnect) are discovered only in production.

Specifications

Features:

  • Write tests for the full reconnection cycle: disconnect → backoff → reconnect attempts → max retries
  • Use Jest fake timers to simulate backoff intervals
  • Test that backoff values are within expected ranges

Tasks:

  • Create __tests__/socket.test.ts
  • Add test cases for: single disconnect + reconnect, max retries exhausted, reconnect during active retry
  • Assert backoff durations using fake timers

Impacted Files:

  • src/services/socket/index.ts
  • __tests__/socket.test.ts (new)

Acceptance Criteria

  • Reconnection test suite covers happy path and max-retry exhaustion
  • Backoff intervals are within ±5% of expected values
  • Tests complete in < 2 seconds using fake timers

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions