Chore: Enable MSW in web/test-runner + add tests for state manager + isCurrentUser util #17584
+587
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR sets up MSW in our test runner, so we can use mock data for our HTTP requests during testing. I have hit a couple of bumps that we'll need to address later on:
I had to turn off the mocks for the installer because it's using a Vite variable that just doesn't play nice with the test runner. Since we don’t really need to run the backoffice installer with mocks at the moment, I think it's fine to leave it like this for now.
I had to duplicate the mockServiceWorker.js file. The test runner can’t locate it in the /public folder, and Vite can’t find it in the project root. Once we upgrade to MSW 2.1, it'll be able to generate the file in multiple locations, so that’s another reason to prioritize the upgrade!