hughhhh commented on a change in pull request #12772:
URL: https://github.com/apache/superset/pull/12772#discussion_r566337228
##########
File path: superset-frontend/spec/javascripts/utils/common_spec.jsx
##########
@@ -86,4 +87,52 @@ describe('utils/common', () => {
expect(applyFormattingToTabularData(originalData)).toEqual(expectedData);
});
});
+ describe('detectOS', () => {
+ it('detects Windows as the OS when appVersion includes Win', () => {
+ const mockNavigator = {
+ // This is the appVersion returned for Mac, with Win replaced on the
initial version
+ // Using this to test that the OS exists for the check
+ appVersion: '5.0 (Win; Intel Mac OS X 10_15_6) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36'
+ }
+ global.navigator = mockNavigator;
+
+ const OSName = jest.fn().mockReturnValue('Windows');
+
+ expect(mockNavigator.appVersion).toMatch(/Win/);
Review comment:
we don't want to test the navigator since we are mocking it
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]