Skip to content

Feat/wait for requests#41

Merged
kevinccbsg merged 2 commits into
mainfrom
feat/wait-for-requests
Oct 7, 2025
Merged

Feat/wait for requests#41
kevinccbsg merged 2 commits into
mainfrom
feat/wait-for-requests

Conversation

@kevinccbsg

Copy link
Copy Markdown
Member

This pull request adds support for waiting for multiple mocked network requests in the test framework and improves error handling for request waiting utilities. The main changes are the introduction of a new waitForRequests function, integration of this utility into the main API, and comprehensive tests to ensure correct behavior.

New multi-request waiting utility:

  • Added a new waitForRequests function to mockBridge.ts that allows waiting for multiple mocked requests in parallel, returning their matched rules.
  • Exposed waitForRequests in the main twd API and updated the TWDAPI interface and implementation to include documentation and usage examples. [1] [2] [3]

Testing improvements:

  • Added a new test suite waitForRequests.spec.ts to verify correct resolution and error handling when waiting for multiple requests.

Error handling improvements:

  • Improved the waitForRequest function to throw an error if a rule is not found or not executed, instead of returning a resolved promise with undefined.

Test usage update:

  • Updated an integration test to use the new waitForRequests utility for waiting on multiple requests, replacing the single-request version.

This closes #34

@kevinccbsg kevinccbsg merged commit 4a7319b into main Oct 7, 2025
4 checks passed
@kevinccbsg kevinccbsg deleted the feat/wait-for-requests branch October 7, 2025 17:58
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.

[command] waitForRequests command

1 participant