From 689f93584588854bb039449f8a7ef40da572835c Mon Sep 17 00:00:00 2001 From: David Ortner Date: Sat, 13 Jan 2024 16:10:32 +0100 Subject: [PATCH] #1207@trivial: Fixes unit tests. --- packages/happy-dom/test/fetch/Fetch.test.ts | 30 ++++++++-------- .../happy-dom/test/fetch/SyncFetch.test.ts | 34 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/happy-dom/test/fetch/Fetch.test.ts b/packages/happy-dom/test/fetch/Fetch.test.ts index 446e2aff9..4c94ccab7 100644 --- a/packages/happy-dom/test/fetch/Fetch.test.ts +++ b/packages/happy-dom/test/fetch/Fetch.test.ts @@ -3585,7 +3585,7 @@ describe('Fetch', () => { expect(requestCount).toBe(1); }); - it('Revalidates cache with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.010".', async () => { + it('Revalidates cache with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.020".', async () => { const window = new Window({ url: 'https://localhost:8080/' }); const url = 'https://localhost:8080/some/path'; const responseText = 'some text'; @@ -3612,7 +3612,7 @@ describe('Fetch', () => { 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT', 'cache-control', - 'max-age=0.010' + 'max-age=0.020' ]; callback(response); @@ -3632,7 +3632,7 @@ describe('Fetch', () => { 'content-length', String(responseText.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT' ]; @@ -3677,7 +3677,7 @@ describe('Fetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT' }); @@ -3690,7 +3690,7 @@ describe('Fetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'Cache-Control': 'max-age=0.010', + 'Cache-Control': 'max-age=0.020', 'Last-Modified': 'Mon, 11 Dec 2023 02:00:00 GMT' }); @@ -3737,7 +3737,7 @@ describe('Fetch', () => { ]); }); - it('Updates cache after a failed revalidation with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.010".', async () => { + it('Updates cache after a failed revalidation with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.020".', async () => { const window = new Window({ url: 'https://localhost:8080/' }); const url = '/some/path'; const responseText1 = 'some text'; @@ -3771,7 +3771,7 @@ describe('Fetch', () => { 'content-length', String(responseText2.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT' ]; @@ -3859,7 +3859,7 @@ describe('Fetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText2.length), - 'cache-control': 'max-age=0.010', + 'cache-control': 'max-age=0.020', 'last-modified': 'Mon, 11 Dec 2023 02:00:00 GMT' }); @@ -3963,7 +3963,7 @@ describe('Fetch', () => { 'content-length', String(responseText.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT', 'etag', @@ -4013,7 +4013,7 @@ describe('Fetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT', etag: etag1 }); @@ -4027,7 +4027,7 @@ describe('Fetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'Last-Modified': 'Mon, 11 Dec 2023 02:00:00 GMT', ETag: etag2 }); @@ -4111,7 +4111,7 @@ describe('Fetch', () => { 'content-length', String(responseText2.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT', 'etag', @@ -4135,7 +4135,7 @@ describe('Fetch', () => { 'content-length', String(responseText1.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT', 'etag', @@ -4182,7 +4182,7 @@ describe('Fetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText1.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT', etag: etag1 }); @@ -4196,7 +4196,7 @@ describe('Fetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText2.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 02:00:00 GMT', etag: etag2 }); diff --git a/packages/happy-dom/test/fetch/SyncFetch.test.ts b/packages/happy-dom/test/fetch/SyncFetch.test.ts index 999bb4eee..5b7346c2b 100644 --- a/packages/happy-dom/test/fetch/SyncFetch.test.ts +++ b/packages/happy-dom/test/fetch/SyncFetch.test.ts @@ -2195,7 +2195,7 @@ describe('SyncFetch', () => { expect(requestCount).toBe(1); }); - it('Revalidates cache with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.010".', async () => { + it('Revalidates cache with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.020".', async () => { browserFrame.url = 'https://localhost:8080/'; const url = 'https://localhost:8080/some/path'; @@ -2216,7 +2216,7 @@ describe('SyncFetch', () => { 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT', 'cache-control', - 'max-age=0.010' + 'max-age=0.020' ], data: '' } @@ -2233,7 +2233,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT' ], @@ -2279,7 +2279,7 @@ describe('SyncFetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT' }); @@ -2292,7 +2292,7 @@ describe('SyncFetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'Cache-Control': 'max-age=0.010', + 'Cache-Control': 'max-age=0.020', 'Last-Modified': 'Mon, 11 Dec 2023 02:00:00 GMT' }); @@ -2329,7 +2329,7 @@ describe('SyncFetch', () => { ]); }); - it('Updates cache after a failed revalidation with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.010".', async () => { + it('Updates cache after a failed revalidation with a "If-Modified-Since" request for a GET response with "Cache-Control" set to "max-age=0.020".', async () => { browserFrame.url = 'https://localhost:8080/'; const url = 'https://localhost:8080/some/path'; @@ -2353,7 +2353,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText2.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT' ], @@ -2372,7 +2372,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText1.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT' ], @@ -2426,7 +2426,7 @@ describe('SyncFetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText1.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT' }); @@ -2439,7 +2439,7 @@ describe('SyncFetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText2.length), - 'cache-control': 'max-age=0.010', + 'cache-control': 'max-age=0.020', 'last-modified': 'Mon, 11 Dec 2023 02:00:00 GMT' }); @@ -2519,7 +2519,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT', 'etag', @@ -2575,7 +2575,7 @@ describe('SyncFetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT', etag: etag1 }); @@ -2589,7 +2589,7 @@ describe('SyncFetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'Last-Modified': 'Mon, 11 Dec 2023 02:00:00 GMT', ETag: etag2 }); @@ -2653,7 +2653,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText2.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 02:00:00 GMT', 'etag', @@ -2674,7 +2674,7 @@ describe('SyncFetch', () => { 'content-length', String(responseText1.length), 'cache-control', - 'max-age=0.010', + 'max-age=0.020', 'last-modified', 'Mon, 11 Dec 2023 01:00:00 GMT', 'etag', @@ -2722,7 +2722,7 @@ describe('SyncFetch', () => { expect(headers1).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText1.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 01:00:00 GMT', etag: etag1 }); @@ -2736,7 +2736,7 @@ describe('SyncFetch', () => { expect(headers2).toEqual({ 'content-type': 'text/html', 'content-length': String(responseText2.length), - 'cache-control': `max-age=0.010`, + 'cache-control': `max-age=0.020`, 'last-modified': 'Mon, 11 Dec 2023 02:00:00 GMT', etag: etag2 });