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

[New Net P1] - adding a reusable mock HTTP client for unit tests #1806

Open
GrandinLuc opened this issue Feb 12, 2025 · 0 comments · May be fixed by #1868
Open

[New Net P1] - adding a reusable mock HTTP client for unit tests #1806

GrandinLuc opened this issue Feb 12, 2025 · 0 comments · May be fixed by #1868
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
@GrandinLuc GrandinLuc changed the title 💡 [REQUEST] - adding a reusable mock HTTP client for unit tests [New Net P1] - adding a reusable mock HTTP client for unit tests Feb 19, 2025
@GrandinLuc GrandinLuc linked a pull request Feb 26, 2025 that will close this issue
11 tasks
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 a pull request may close this issue.

1 participant