File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 11import { SlackFunctionTester } from "deno-slack-sdk/mod.ts" ;
22import { assert , assertEquals , assertNotEquals } from "@std/assert" ;
33import handler from "./translate.ts" ;
4- import { StubFetch } from "./test_utils.ts" ;
4+ import { StubFetch } from ".. /test_utils.ts" ;
55
66// Replaces globalThis.fetch with the stub copy
77const stubFetch = new StubFetch ( ) ;
Original file line number Diff line number Diff line change @@ -37,14 +37,14 @@ export class UnmatchedRequestError extends Error {
3737
3838export class StubFetch {
3939 private stubs : Map < string , StubRequestHandler > = new Map ( ) ;
40- private stubFetchInstance : Stub | null = null ;
40+ private stubFetchInstance : Stub ;
4141
4242 /**
4343 * Creates a new StubFetch instance and automatically installs it.
4444 * The global fetch function is replaced with the stub immediately upon creation.
4545 */
4646 constructor ( ) {
47- this . install ( ) ;
47+ this . stubFetchInstance = this . install ( ) ;
4848 }
4949
5050 /**
@@ -127,7 +127,6 @@ export class StubFetch {
127127 restore ( ) : void {
128128 if ( this . stubFetchInstance ) {
129129 this . stubFetchInstance . restore ( ) ;
130- this . stubFetchInstance = null ;
131130 }
132131 }
133132}
You can’t perform that action at this time.
0 commit comments