Skip to content

Commit

Permalink
capricorn86#521@patch: Fixes test units error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mas0nShi committed Jul 1, 2022
1 parent d1f8256 commit a1c0e81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/happy-dom/test/location/URL.test.ts
Expand Up @@ -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('');
Expand Down
4 changes: 2 additions & 2 deletions packages/happy-dom/test/nodes/document/Document.test.ts
Expand Up @@ -184,15 +184,15 @@ 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/';
expect(document.cookie).toBe('name1=value1; name2=value2; name3=value3');
});

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('');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/happy-dom/test/window/Window.test.ts
Expand Up @@ -24,6 +24,7 @@ describe('Window', () => {
MOCKED_NODE_FETCH.error = null;
window = new Window();
document = window.document;
window.location.href = 'http://localhost:8080/';
});

afterEach(() => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a1c0e81

Please sign in to comment.