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 resolveBrowserLocale tests #7194

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

FernandoKGA
Copy link
Contributor

Noticed a bug at resolveBrowserLocale tests during #7170 investigation to implement a new feature (#7193).

Problem:
As navigator.language is a read-only property (see MDN page about it), it wasn't being affected by the window.navigator = {}. You can see that at should return default locale if there's no available locale in browser test, it is an invalid test.

Captura de tela em 2022-02-05 18-09-45

Solution:
Implement correctly using jest.spyOn function, see this answer: https://stackoverflow.com/a/52870312
Captura de tela em 2022-02-05 17-35-07

Should this fix enter before #7193 @WiXSL ?

@vercel vercel bot temporarily deployed to Preview – react-admin February 5, 2022 21:24 Inactive
@vercel vercel bot temporarily deployed to Preview – react-admin-storybook February 5, 2022 21:24 Inactive
@WiXSL
Copy link
Contributor

WiXSL commented Feb 6, 2022

Thank you for taking the time to work on this.

@djhi djhi merged commit 32a6ec3 into marmelab:master Feb 7, 2022
@djhi
Copy link
Collaborator

djhi commented Feb 7, 2022

Thanks!

@djhi djhi added this to the v3.19.8 milestone Feb 7, 2022
@FernandoKGA FernandoKGA deleted the fix-translation-utils-tests branch February 7, 2022 11:37
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.

3 participants