-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix(analytics): fix analytics hook for expired or logged out #31
Conversation
Pull Request Report PR Title ✅ Title follows the conventional commit spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing awaits I think :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some refactor possible :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await in the tests are still leakin' 😅
mockedAuthenticationStatus.mockImplementationOnce(() => | ||
Promise.resolve(AuthenticationStatus.EXPIRED) | ||
); | ||
expect(async () => await hook(getAnalyticsHook({}))).not.toThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you uses async/await, follow closely what's in https://jestjs.io/docs/en/asynchronous.
So here it should be
expect(async () => await hook(getAnalyticsHook({}))).not.toThrow(); | |
await expect(() => hook(getAnalyticsHook({})))..resolves.not.toThrow(); |
I removed the async/await inside because they were not necessary, because hook
is returning a promise.
The important await is in the call back of the it
statement :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fessed up
Co-authored-by: Louis Bompart <[email protected]>
https://coveord.atlassian.net/browse/CDX-84