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

Replacing MockClass with export classes and stubs #1125

Merged
merged 10 commits into from
Jan 15, 2025

Conversation

araujoarthur0
Copy link
Collaborator

Related issue

Closes #1124

Context / Background

The MockClass class was create to replace the jest mocks as ES6 didn't allow mocking exported functions.
Turns out that sinon stub() could also be used if the export of a file was a whole class. It will replace the implementation used across all places where that class has been imported.
So we can easily replace the MockClass exports with creating a single normal class to hold the exports of a file.

What change is being introduced by this PR?

Modified files that used MockClass to have their own common export classes. Functions are all changed to be static functions of those classes.
Fixed import-export test to no longer leave leftover folders in the repo.

How will this be tested?

Same tests passing

Copy link
Collaborator

@tupaschoal tupaschoal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine, I'm glad it's one less thing we have to maintain 🙏

@tupaschoal tupaschoal merged commit 774787f into TTLApp:main Jan 15, 2025
3 checks passed
@araujoarthur0 araujoarthur0 deleted the no-mock-class branch January 15, 2025 14:49
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.

Don't load Mock.mjs in production
2 participants