Skip to content

Commit

Permalink
#1207@trivial: Fixes unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed Jan 13, 2024
1 parent bf84b11 commit 689f935
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
30 changes: 15 additions & 15 deletions packages/happy-dom/test/fetch/Fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
Expand All @@ -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'
];
Expand Down Expand Up @@ -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'
});

Expand All @@ -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'
});

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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'
];
Expand Down Expand Up @@ -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'
});

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
});
Expand All @@ -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
});
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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
});
Expand All @@ -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
});
Expand Down
34 changes: 17 additions & 17 deletions packages/happy-dom/test/fetch/SyncFetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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: ''
}
Expand All @@ -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'
],
Expand Down Expand Up @@ -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'
});

Expand All @@ -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'
});

Expand Down Expand Up @@ -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';
Expand All @@ -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'
],
Expand All @@ -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'
],
Expand Down Expand Up @@ -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'
});

Expand All @@ -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'
});

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
});
Expand All @@ -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
});
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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
});
Expand All @@ -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
});
Expand Down

0 comments on commit 689f935

Please sign in to comment.