Skip to content
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

Merged
merged 10 commits into from
Feb 23, 2021
Merged

Conversation

olamothe
Copy link
Member

@github-actions
Copy link
Contributor

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Copy link
Collaborator

@louis-bompart louis-bompart left a 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 :)

Copy link
Collaborator

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some refactor possible :)

Copy link
Collaborator

@louis-bompart louis-bompart left a 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();
Copy link
Collaborator

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

Suggested change
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 :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fessed up

@olamothe olamothe merged commit 1c9964e into master Feb 23, 2021
@olamothe olamothe deleted the CDX-84 branch February 23, 2021 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants