mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
Q1: type the proxy-transport test doubles (typecheck:test ratchet)
This commit is contained in:
1 parent
b2c3e15a1d
commit
d98b7c1e0f
1 file changed
+6
-6
@@ -256,14 +256,14 @@ describe('proxy terminal event ordering', () => {
|
||||
let onResponse!: (res: IncomingMessage) => void;
|
||||
let deadline!: () => void;
|
||||
const nativeSetTimeout = globalThis.setTimeout;
|
||||
const requestSpy = spyOn(http, 'request').mockImplementation((url, options, callback) => {
|
||||
const requestSpy = spyOn(http, 'request').mockImplementation(((_url: unknown, _options: unknown, callback?: (res: IncomingMessage) => void) => {
|
||||
onResponse = callback!;
|
||||
return request as unknown as ClientRequest;
|
||||
});
|
||||
const timerSpy = spyOn(globalThis, 'setTimeout').mockImplementation((callback, ms, ...args) => {
|
||||
deadline = callback as () => void;
|
||||
return nativeSetTimeout(callback, ms, ...args);
|
||||
});
|
||||
}) as unknown as typeof http.request);
|
||||
const timerSpy = spyOn(globalThis, 'setTimeout').mockImplementation(((callback: () => void, ms?: number) => {
|
||||
deadline = callback;
|
||||
return nativeSetTimeout(callback, ms);
|
||||
}) as unknown as typeof setTimeout);
|
||||
const clearSpy = spyOn(globalThis, 'clearTimeout');
|
||||
try {
|
||||
const pending = attempt(1).then(value => ({ value, error: undefined }), error => ({ value: undefined, error }));
|
||||
|
||||
Reference in new issue
Block a user