Skip to content

test(api): add unit tests for requestDeduplicator module (closes #1192) - #1206

Open
rupesh-kumar-sah wants to merge 1 commit into
rinafcode:mainfrom
rupesh-kumar-sah:test/issue-1192-request-deduplicator
Open

rupesh-kumar-sah wants to merge 1 commit into
rinafcode:mainfrom
rupesh-kumar-sah:test/issue-1192-request-deduplicator

Conversation

@rupesh-kumar-sah

Copy link
Copy Markdown

Overview

Closes #1192.

Adds comprehensive unit tests for in .

Test Coverage

  • Constants and Exports: Verifies (30s), (100), and singleton instance.
  • Concurrent Request Deduplication: Verifies multiple concurrent identical requests resolve to a single network call invocation.
  • State Properties: Tests and properties tracking active in-flight calls and returning to 0 upon completion.
  • Sequential Execution: Asserts that subsequent calls after settlement execute freshly.
  • Key Differentiation: Confirms distinct requests are differentiated by HTTP method, endpoint path, and query params.
  • Error Propagation: Ensures executor errors reject all waiting subscribers and purge the failed entry so future attempts can retry cleanly.
  • Cancellation & Cleanup: Tests propagation, invocation, and LRU cache eviction when exceeding .

Verification

  • Linted with ESLint and formatted with Prettier (0 errors, 0 warnings).

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.

Add unit tests for src/services/api/requestDeduplicator.ts

1 participant