[MM-52587] Clean up URL utils, use isInternalURL when possible (#2702)

This commit is contained in:
Devin Binnie
2023-05-03 08:48:41 -04:00
committed by GitHub
parent f3a4417464
commit e227c6bf1d
30 changed files with 481 additions and 634 deletions

View File

@@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import {TAB_MESSAGING, TAB_FOCALBOARD, TAB_PLAYBOOKS} from 'common/tabs/TabView';
import urlUtils, {equalUrlsIgnoringSubpath} from 'common/utils/url';
import {parseURL, isInternalURL} from 'common/utils/url';
import Utils from 'common/utils/util';
import {ServerManager} from './serverManager';
@@ -12,7 +12,7 @@ jest.mock('common/config', () => ({
}));
jest.mock('common/utils/url', () => ({
parseURL: jest.fn(),
equalUrlsIgnoringSubpath: jest.fn(),
isInternalURL: jest.fn(),
}));
jest.mock('common/utils/util', () => ({
isVersionGreaterThanOrEqualTo: jest.fn(),
@@ -125,8 +125,8 @@ describe('common/servers/serverManager', () => {
};
beforeEach(() => {
urlUtils.parseURL.mockImplementation((url) => new URL(url));
equalUrlsIgnoringSubpath.mockImplementation((url1, url2) => `${url1}`.startsWith(`${url2}`));
parseURL.mockImplementation((url) => new URL(url));
isInternalURL.mockImplementation((url1, url2) => `${url1}`.startsWith(`${url2}`));
});
afterEach(() => {