AzureAD / microsoft-authentication-library-for-js

Microsoft Authentication Library (MSAL) for JS
http://aka.ms/aadv2
MIT License
3.63k stars 2.64k forks source link

Hackathon: msal-common - Replaced sinon with jest #7322

Closed Robbie-Microsoft closed 3 days ago

Robbie-Microsoft commented 1 week ago

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 and SilentFlowClient. 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 in RefreshTokenClient and AuthorizationCodeClient. Otherwise, the files didn't need overhauling and sinon was simply swapped out for jest.

Additionally, jest's toThrowError is deprecated, in favor of toThrow. I went ahead and made this replacement in every msal-common unit test file, where applicable.