@@ -73,6 +73,7 @@ describe("client", () => {
7373 core : core ,
7474 logger : new Logger ( core ) . logger ,
7575 inputs : {
76+ api : "http://localhost:8080/api" ,
7677 method : "pins.add" ,
7778 retries : "10" ,
7879 token : "xoxb-example-002" ,
@@ -86,6 +87,7 @@ describe("client", () => {
8687 agent : undefined ,
8788 logger : config . logger ,
8889 retryConfig : webapi . retryPolicies . tenRetriesInAboutThirtyMinutes ,
90+ slackApiUrl : "http://localhost:8080/api" ,
8991 } ) ,
9092 ) ;
9193 } ) ;
@@ -110,10 +112,10 @@ describe("client", () => {
110112 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
111113 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
112114 mocks . core . getInput . withArgs ( "payload" ) . returns ( JSON . stringify ( args ) ) ;
113- mocks . api . resolves ( response ) ;
115+ mocks . calls . resolves ( response ) ;
114116 await send ( mocks . core ) ;
115- assert . deepEqual ( mocks . api . getCall ( 0 ) . firstArg , "chat.postMessage" ) ;
116- assert . deepEqual ( mocks . api . getCall ( 0 ) . lastArg , args ) ;
117+ assert . deepEqual ( mocks . calls . getCall ( 0 ) . firstArg , "chat.postMessage" ) ;
118+ assert . deepEqual ( mocks . calls . getCall ( 0 ) . lastArg , args ) ;
117119 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . firstArg , "ok" ) ;
118120 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . lastArg , true ) ;
119121 assert . equal ( mocks . core . setOutput . getCall ( 1 ) . firstArg , "response" ) ;
@@ -158,10 +160,10 @@ describe("client", () => {
158160 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
159161 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
160162 mocks . core . getInput . withArgs ( "payload" ) . returns ( JSON . stringify ( args ) ) ;
161- mocks . api . resolves ( response ) ;
163+ mocks . calls . resolves ( response ) ;
162164 await send ( mocks . core ) ;
163- assert . deepEqual ( mocks . api . getCall ( 0 ) . firstArg , "chat.postMessage" ) ;
164- assert . deepEqual ( mocks . api . getCall ( 0 ) . lastArg , args ) ;
165+ assert . deepEqual ( mocks . calls . getCall ( 0 ) . firstArg , "chat.postMessage" ) ;
166+ assert . deepEqual ( mocks . calls . getCall ( 0 ) . lastArg , args ) ;
165167 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . firstArg , "ok" ) ;
166168 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . lastArg , true ) ;
167169 assert . equal ( mocks . core . setOutput . getCall ( 1 ) . firstArg , "response" ) ;
@@ -194,9 +196,9 @@ describe("client", () => {
194196 mocks . core . getInput . withArgs ( "method" ) . returns ( "files.uploadV2" ) ;
195197 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxp-example" ) ;
196198 mocks . core . getInput . withArgs ( "payload" ) . returns ( JSON . stringify ( args ) ) ;
197- mocks . api . resolves ( response ) ;
199+ mocks . calls . resolves ( response ) ;
198200 await send ( mocks . core ) ;
199- assert . deepEqual ( mocks . api . getCall ( 0 ) . lastArg , args ) ;
201+ assert . deepEqual ( mocks . calls . getCall ( 0 ) . lastArg , args ) ;
200202 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . firstArg , "ok" ) ;
201203 assert . equal ( mocks . core . setOutput . getCall ( 0 ) . lastArg , true ) ;
202204 assert . equal ( mocks . core . setOutput . getCall ( 1 ) . firstArg , "response" ) ;
@@ -231,7 +233,7 @@ describe("client", () => {
231233 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
232234 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
233235 mocks . core . getInput . withArgs ( "payload" ) . returns ( `"text": "hello"` ) ;
234- mocks . api . rejects ( errors . requestErrorWithOriginal ( response , true ) ) ;
236+ mocks . calls . rejects ( errors . requestErrorWithOriginal ( response , true ) ) ;
235237 await send ( mocks . core ) ;
236238 assert . fail ( "Expected an error but none was found" ) ;
237239 } catch ( error ) {
@@ -266,7 +268,7 @@ describe("client", () => {
266268 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
267269 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
268270 mocks . core . getInput . withArgs ( "payload" ) . returns ( `"text": "hello"` ) ;
269- mocks . api . rejects ( errors . httpErrorFromResponse ( response ) ) ;
271+ mocks . calls . rejects ( errors . httpErrorFromResponse ( response ) ) ;
270272 await send ( mocks . core ) ;
271273 assert . fail ( "Expected an error but none was found" ) ;
272274 } catch ( error ) {
@@ -302,7 +304,7 @@ describe("client", () => {
302304 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
303305 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
304306 mocks . core . getInput . withArgs ( "payload" ) . returns ( `"text": "hello"` ) ;
305- mocks . api . rejects ( errors . platformErrorFromResult ( response ) ) ;
307+ mocks . calls . rejects ( errors . platformErrorFromResult ( response ) ) ;
306308 await send ( mocks . core ) ;
307309 assert . fail ( "Expected an error but none was found" ) ;
308310 } catch ( error ) {
@@ -331,7 +333,7 @@ describe("client", () => {
331333 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
332334 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
333335 mocks . core . getInput . withArgs ( "payload" ) . returns ( `"text": "hello"` ) ;
334- mocks . api . rejects ( errors . platformErrorFromResult ( response ) ) ;
336+ mocks . calls . rejects ( errors . platformErrorFromResult ( response ) ) ;
335337 await send ( mocks . core ) ;
336338 assert . fail ( "Expected an error but none was found" ) ;
337339 } catch ( error ) {
@@ -357,7 +359,7 @@ describe("client", () => {
357359 mocks . core . getInput . withArgs ( "method" ) . returns ( "chat.postMessage" ) ;
358360 mocks . core . getInput . withArgs ( "token" ) . returns ( "xoxb-example" ) ;
359361 mocks . core . getInput . withArgs ( "payload" ) . returns ( `"text": "hello"` ) ;
360- mocks . api . rejects ( errors . rateLimitedErrorWithDelay ( 12 ) ) ;
362+ mocks . calls . rejects ( errors . rateLimitedErrorWithDelay ( 12 ) ) ;
361363 await send ( mocks . core ) ;
362364 assert . fail ( "Expected an error but none was found" ) ;
363365 } catch ( error ) {
0 commit comments