Skip to content

Commit

Permalink
Fix unit test case
Browse files Browse the repository at this point in the history
  • Loading branch information
poovamraj committed Nov 28, 2023
1 parent 4f6a8e1 commit 511dc7c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/webauth/__tests__/agent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,15 @@ describe('Agent', () => {
jest
.spyOn(Linking, 'addEventListener')
.mockReturnValueOnce(mockSubscription);
await agent.login({}, { safariViewControllerPresentationStyle: 0 });
expect(Linking.addEventListener).toHaveBeenCalledTimes(1);
jest
.spyOn(nativeUtils, '_ensureNativeModuleIsInitialized')
.mockImplementationOnce(() => {
throw Error('123123');
});
try {
await agent.login({}, {});
} catch (e) {}
expect(Linking.addEventListener).toHaveBeenCalledTimes(0);
expect(mockSubscription.remove).toHaveBeenCalledTimes(0);
});
});
Expand Down

0 comments on commit 511dc7c

Please sign in to comment.