diff --git a/packages/happy-dom/test/location/URL.test.ts b/packages/happy-dom/test/location/URL.test.ts index 7a8477f49..3e94013cc 100644 --- a/packages/happy-dom/test/location/URL.test.ts +++ b/packages/happy-dom/test/location/URL.test.ts @@ -40,7 +40,7 @@ describe('URL', () => { expect(url.href).toBe(href); expect(url.protocol).toBe('https:'); expect(url.hostname).toBe('google.com'); - expect(url.port).toBe(':8080'); + expect(url.port).toBe('8080'); expect(url.pathname).toBe('/some-path/'); expect(url.search).toBe(''); expect(url.hash).toBe(''); diff --git a/packages/happy-dom/test/nodes/document/Document.test.ts b/packages/happy-dom/test/nodes/document/Document.test.ts index 02c151f2a..5a349c028 100644 --- a/packages/happy-dom/test/nodes/document/Document.test.ts +++ b/packages/happy-dom/test/nodes/document/Document.test.ts @@ -184,7 +184,7 @@ describe('Document', () => { }); it('Sets a cookie with a path.', () => { - window.location.href = '/path/to/cookie/'; + window.location.href = 'https://sub.test.com/path/to/cookie/'; document.cookie = 'name1=value1; path=path/to'; document.cookie = 'name2=value2; path=/path/to'; document.cookie = 'name3=value3; path=/path/to/cookie/'; @@ -192,7 +192,7 @@ describe('Document', () => { }); it('Does not set cookie if the path does not match the current path.', () => { - window.location.href = '/path/to/cookie/'; + window.location.href = 'https://sub.test.com/path/to/cookie/'; document.cookie = 'name1=value1; path=/cookie/'; expect(document.cookie).toBe(''); }); diff --git a/packages/happy-dom/test/window/Window.test.ts b/packages/happy-dom/test/window/Window.test.ts index 5c2239e25..34eb6a6fe 100644 --- a/packages/happy-dom/test/window/Window.test.ts +++ b/packages/happy-dom/test/window/Window.test.ts @@ -24,6 +24,7 @@ describe('Window', () => { MOCKED_NODE_FETCH.error = null; window = new Window(); document = window.document; + window.location.href = 'http://localhost:8080/'; }); afterEach(() => { @@ -322,7 +323,6 @@ describe('Window', () => { it('Handles error JSON request.', async () => { MOCKED_NODE_FETCH.error = new Error('error'); - try { await window.fetch('/url/', {}); } catch (error) {