| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,6 @@ | |||
| 3 | 3 | /* global WebAssembly */ | |
| 4 | 4 | ||
| 5 | 5 | const assert = require('node:assert') | |
| 6 | - const { setTimeout: setTimeoutNative, clearTimeout: clearTimeoutNative } = require('node:timers') | ||
| 7 | 6 | const util = require('../core/util.js') | |
| 8 | 7 | const { channels } = require('../core/diagnostics.js') | |
| 9 | 8 | const timers = require('../util/timers.js') | |
@@ -1012,7 +1011,7 @@ function onSocketClose () { | |||
| 1012 | 1011 | ||
| 1013 | 1012 | function clearIdleSocketValidation (socket) { | |
| 1014 | 1013 | if (socket[kIdleSocketValidationTimeout]) { | |
| 1015 | - clearTimeoutNative(socket[kIdleSocketValidationTimeout]) | ||
| 1014 | + clearTimeout(socket[kIdleSocketValidationTimeout]) | ||
| 1016 | 1015 | socket[kIdleSocketValidationTimeout] = null | |
| 1017 | 1016 | } | |
| 1018 | 1017 | ||
@@ -1021,7 +1020,7 @@ function clearIdleSocketValidation (socket) { | |||
| 1021 | 1020 | ||
| 1022 | 1021 | function scheduleIdleSocketValidation (client, socket) { | |
| 1023 | 1022 | socket[kIdleSocketValidation] = 1 | |
| 1024 | - socket[kIdleSocketValidationTimeout] = setTimeoutNative(() => { | ||
| 1023 | + socket[kIdleSocketValidationTimeout] = setTimeout(() => { | ||
| 1025 | 1024 | socket[kIdleSocketValidationTimeout] = null | |
| 1026 | 1025 | socket[kIdleSocketValidation] = 2 | |
| 1027 | 1026 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -171,7 +171,7 @@ describe('Cache Interceptor', () => { | |||
| 171 | 171 | ||
| 172 | 172 | test('expires caching', async () => { | |
| 173 | 173 | const clock = FakeTimers.install({ | |
| 174 | - shouldClearNativeTimers: true | ||
| 174 | + toFake: ['Date'] | ||
| 175 | 175 | }) | |
| 176 | 176 | ||
| 177 | 177 | let requestsToOrigin = 0 | |
@@ -248,7 +248,7 @@ describe('Cache Interceptor', () => { | |||
| 248 | 248 | ||
| 249 | 249 | test('expires caching with Etag', async () => { | |
| 250 | 250 | const clock = FakeTimers.install({ | |
| 251 | - shouldClearNativeTimers: true | ||
| 251 | + toFake: ['Date'] | ||
| 252 | 252 | }) | |
| 253 | 253 | ||
| 254 | 254 | let requestsToOrigin = 0 | |
@@ -326,7 +326,7 @@ describe('Cache Interceptor', () => { | |||
| 326 | 326 | ||
| 327 | 327 | test('max-age caching', async () => { | |
| 328 | 328 | const clock = FakeTimers.install({ | |
| 329 | - shouldClearNativeTimers: true | ||
| 329 | + toFake: ['Date'] | ||
| 330 | 330 | }) | |
| 331 | 331 | ||
| 332 | 332 | let requestsToOrigin = 0 | |
@@ -390,7 +390,7 @@ describe('Cache Interceptor', () => { | |||
| 390 | 390 | ||
| 391 | 391 | test('vary headers are present in revalidation request', async () => { | |
| 392 | 392 | const clock = FakeTimers.install({ | |
| 393 | - shouldClearNativeTimers: true | ||
| 393 | + toFake: ['Date'] | ||
| 394 | 394 | }) | |
| 395 | 395 | ||
| 396 | 396 | let requestsToOrigin = 0 | |
@@ -669,7 +669,7 @@ describe('Cache Interceptor', () => { | |||
| 669 | 669 | ||
| 670 | 670 | test('stale-if-error (response)', async () => { | |
| 671 | 671 | const clock = FakeTimers.install({ | |
| 672 | - shouldClearNativeTimers: true | ||
| 672 | + toFake: ['Date'] | ||
| 673 | 673 | }) | |
| 674 | 674 | ||
| 675 | 675 | let requestsToOrigin = 0 | |
@@ -751,7 +751,7 @@ describe('Cache Interceptor', () => { | |||
| 751 | 751 | describe('Client-side directives', () => { | |
| 752 | 752 | test('max-age', async () => { | |
| 753 | 753 | const clock = FakeTimers.install({ | |
| 754 | - shouldClearNativeTimers: true | ||
| 754 | + toFake: ['Date'] | ||
| 755 | 755 | }) | |
| 756 | 756 | ||
| 757 | 757 | let requestsToOrigin = 0 | |
@@ -812,7 +812,7 @@ describe('Cache Interceptor', () => { | |||
| 812 | 812 | ||
| 813 | 813 | test('max-stale', async () => { | |
| 814 | 814 | const clock = FakeTimers.install({ | |
| 815 | - shouldClearNativeTimers: true | ||
| 815 | + toFake: ['Date'] | ||
| 816 | 816 | }) | |
| 817 | 817 | ||
| 818 | 818 | let requestsToOrigin = 0 | |
@@ -885,7 +885,7 @@ describe('Cache Interceptor', () => { | |||
| 885 | 885 | ||
| 886 | 886 | test('min-fresh', async () => { | |
| 887 | 887 | const clock = FakeTimers.install({ | |
| 888 | - shouldClearNativeTimers: true | ||
| 888 | + toFake: ['Date'] | ||
| 889 | 889 | }) | |
| 890 | 890 | ||
| 891 | 891 | let requestsToOrigin = 0 | |
@@ -1103,7 +1103,7 @@ describe('Cache Interceptor', () => { | |||
| 1103 | 1103 | ||
| 1104 | 1104 | test('stale-if-error', async () => { | |
| 1105 | 1105 | const clock = FakeTimers.install({ | |
| 1106 | - shouldClearNativeTimers: true | ||
| 1106 | + toFake: ['Date'] | ||
| 1107 | 1107 | }) | |
| 1108 | 1108 | ||
| 1109 | 1109 | let requestsToOrigin = 0 | |
@@ -1988,7 +1988,7 @@ describe('Cache Interceptor', () => { | |||
| 1988 | 1988 | ||
| 1989 | 1989 | describe('determineDeleteAt', () => { | |
| 1990 | 1990 | test('max-age response has deleteAt proportional to freshness lifetime, not 1 year', async () => { | |
| 1991 | - const clock = FakeTimers.install({ now: 1000 }) | ||
| 1991 | + const clock = FakeTimers.install({ now: 1000, toFake: ['Date'] }) | ||
| 1992 | 1992 | after(() => clock.uninstall()) | |
| 1993 | 1993 | ||
| 1994 | 1994 | const store = new MemoryCacheStore() | |
@@ -2024,7 +2024,7 @@ describe('Cache Interceptor', () => { | |||
| 2024 | 2024 | }) | |
| 2025 | 2025 | ||
| 2026 | 2026 | test('immutable response has deleteAt of ~1 year', async () => { | |
| 2027 | - const clock = FakeTimers.install({ now: 1000 }) | ||
| 2027 | + const clock = FakeTimers.install({ now: 1000, toFake: ['Date'] }) | ||
| 2028 | 2028 | after(() => clock.uninstall()) | |
| 2029 | 2029 | ||
| 2030 | 2030 | const store = new MemoryCacheStore() | |
@@ -2058,7 +2058,7 @@ describe('Cache Interceptor', () => { | |||
| 2058 | 2058 | }) | |
| 2059 | 2059 | ||
| 2060 | 2060 | test('stale-while-revalidate extends deleteAt beyond staleAt', async () => { | |
| 2061 | - const clock = FakeTimers.install({ now: 1000 }) | ||
| 2061 | + const clock = FakeTimers.install({ now: 1000, toFake: ['Date'] }) | ||
| 2062 | 2062 | after(() => clock.uninstall()) | |
| 2063 | 2063 | ||
| 2064 | 2064 | const store = new MemoryCacheStore() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments