Hackathon: msal-common - Replaced sinon with jest #7322
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.
I went through every msal-common unit test and replaced sinon with jest.
In addition to replacing sinon with jest, I tried to completely overhaul the test files that need work (not re-using code - this is majorly inflating some of the unit test files, etc). I only got through a few files before realizing that I won't finish in time for hackathon week. The files I finished overhauling are:
Logger
,ThrottlingUtils
,NetworkManager
andSilentFlowClient
. Since I'm running out of time and want to replace sinon with jest in msal-browser as well, I gave up overhauling and simply replaced sinon with jest inRefreshTokenClient
andAuthorizationCodeClient
. Otherwise, the files didn't need overhauling and sinon was simply swapped out for jest.Additionally, jest's
toThrowError
is deprecated, in favor oftoThrow
. I went ahead and made this replacement in every msal-common unit test file, where applicable.