Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡 [REQUEST] - adding a reusable mock HTTP client for unit tests #1806

Open
GrandinLuc opened this issue Feb 12, 2025 · 0 comments
Open

💡 [REQUEST] - adding a reusable mock HTTP client for unit tests #1806

GrandinLuc opened this issue Feb 12, 2025 · 0 comments
Assignees

Comments

@GrandinLuc
Copy link
Collaborator

Summary

In the new thor package, for the unit tests we are currently using a hardcoded mockHttpClient method on every unit tests so to avoid all that copy/paste this ticket aims to have a MockHttpClient that is light-weight and modulable for all the unit tests current and future.

Basic Example

This is the current mockHttpClient (this one is only for POST requests:
const mockHttpClient = <T>(response: T): FetchHttpClient => { return { post: jest.fn().mockImplementation(() => { return { json: jest.fn().mockImplementation(() => { return response; }) }; }) } as unknown as FetchHttpClient; };

@GrandinLuc GrandinLuc added this to the 2.0.0-beta (Pre-Release) milestone Feb 12, 2025
@GrandinLuc GrandinLuc self-assigned this Feb 12, 2025
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

No branches or pull requests

1 participant