From 82f96a9ae2529898de0e91ccfad1d6457f3c1975 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 23 May 2023 00:07:55 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/lib/utils/url_utility_spec.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'spec/frontend/lib') diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index 4bf3a779f00..f41fe140ba1 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -406,7 +406,9 @@ describe('URL utility', () => { Object.defineProperty(window, 'location', { writable: true, - value: new URL(TEST_HOST), + value: { + assign: jest.fn(), + }, }); }); @@ -417,11 +419,15 @@ describe('URL utility', () => { it('navigates to a page', () => { urlUtils.visitUrl(mockUrl); - expect(window.location.href).toBe(mockUrl); + expect(window.location.assign).toHaveBeenCalledWith(mockUrl); }); it('navigates to a new page', () => { - const otherWindow = {}; + const otherWindow = { + location: { + assign: jest.fn(), + }, + }; Object.defineProperty(window, 'open', { writable: true, @@ -431,7 +437,7 @@ describe('URL utility', () => { urlUtils.visitUrl(mockUrl, true); expect(otherWindow.opener).toBe(null); - expect(otherWindow.location).toBe(mockUrl); + expect(otherWindow.location.assign).toHaveBeenCalledWith(mockUrl); }); }); -- cgit v1.2.3