@@ -138,10 +138,14 @@ describe("slack web client config", () => {
138138 try {
139139 createSlackReadClient ( "xoxb-read" ) ;
140140
141- expect ( WebClient ) . toHaveBeenCalledWith ( "xoxb-read" , {
142- retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
143- timeout : 30_000 ,
144- } ) ;
141+ expect ( WebClient ) . toHaveBeenCalledWith (
142+ "xoxb-read" ,
143+ expect . objectContaining ( {
144+ fetch : expect . any ( Function ) ,
145+ retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
146+ timeout : 30_000 ,
147+ } ) ,
148+ ) ;
145149 } finally {
146150 restoreProxyEnvForTest ( ) ;
147151 }
@@ -152,10 +156,14 @@ describe("slack web client config", () => {
152156 try {
153157 createSlackReadClient ( "xoxb-read" , { timeout : 60_000 } ) ;
154158
155- expect ( WebClient ) . toHaveBeenCalledWith ( "xoxb-read" , {
156- retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
157- timeout : 60_000 ,
158- } ) ;
159+ expect ( WebClient ) . toHaveBeenCalledWith (
160+ "xoxb-read" ,
161+ expect . objectContaining ( {
162+ fetch : expect . any ( Function ) ,
163+ retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
164+ timeout : 60_000 ,
165+ } ) ,
166+ ) ;
159167 } finally {
160168 restoreProxyEnvForTest ( ) ;
161169 }
@@ -250,10 +258,14 @@ describe("slack web client config", () => {
250258 try {
251259 createSlackWebClient ( "xoxb-test" , { timeout : 1234 } ) ;
252260
253- expect ( WebClient ) . toHaveBeenCalledWith ( "xoxb-test" , {
254- retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
255- timeout : 1234 ,
256- } ) ;
261+ expect ( WebClient ) . toHaveBeenCalledWith (
262+ "xoxb-test" ,
263+ expect . objectContaining ( {
264+ fetch : expect . any ( Function ) ,
265+ retryConfig : SLACK_DEFAULT_RETRY_OPTIONS ,
266+ timeout : 1234 ,
267+ } ) ,
268+ ) ;
257269 } finally {
258270 restoreProxyEnvForTest ( ) ;
259271 }
@@ -413,9 +425,9 @@ describe("slack proxy dispatcher", () => {
413425 await dispatcher ?. close ( ) ;
414426 } ) ;
415427
416- it ( "does not attach a fetch when no proxy env var is configured" , ( ) => {
428+ it ( "attaches the shared fetch when no proxy env var is configured" , ( ) => {
417429 expect ( resolveSlackProxyDispatcher ( ) ) . toBeUndefined ( ) ;
418- expect ( resolveSlackWebClientOptions ( ) . fetch ) . toBeUndefined ( ) ;
430+ expect ( requireFetch ( resolveSlackWebClientOptions ( ) ) ) . toBeTypeOf ( "function" ) ;
419431 } ) ;
420432
421433 it ( "preserves an explicitly provided fetch" , async ( ) => {
@@ -464,6 +476,6 @@ describe("slack proxy dispatcher", () => {
464476 process . env . HTTPS_PROXY = "not-a-valid-url://:::bad" ;
465477
466478 expect ( resolveSlackProxyDispatcher ( ) ) . toBeUndefined ( ) ;
467- expect ( resolveSlackWebClientOptions ( ) . fetch ) . toBeUndefined ( ) ;
479+ expect ( requireFetch ( resolveSlackWebClientOptions ( ) ) ) . toBeTypeOf ( "function" ) ;
468480 } ) ;
469481} ) ;
0 commit comments