@@ -2,9 +2,11 @@ import core from "@actions/core";
22import webapi from "@slack/web-api" ;
33import errors from "@slack/web-api/dist/errors.js" ;
44import { assert } from "chai" ;
5+ import sinon from "sinon" ;
56import Client from "../src/client.js" ;
67import Config from "../src/config.js" ;
78import SlackError from "../src/errors.js" ;
9+ import Logger from "../src/logger.js" ;
810import send from "../src/send.js" ;
911import { mocks } from "./index.spec.js" ;
1012
@@ -58,6 +60,35 @@ describe("client", () => {
5860 }
5961 }
6062 } ) ;
63+
64+ it ( "uses input arguments when constructing the web api client" , async ( ) => {
65+ const spy = sinon . spy ( mocks . webapi , "WebClient" ) ;
66+ /**
67+ * @type {Config }
68+ */
69+ const config = {
70+ content : {
71+ values : { } ,
72+ } ,
73+ core : core ,
74+ logger : new Logger ( core ) . logger ,
75+ inputs : {
76+ method : "pins.add" ,
77+ retries : "10" ,
78+ token : "xoxb-example-002" ,
79+ } ,
80+ webapi : mocks . webapi ,
81+ } ;
82+ await new Client ( ) . post ( config ) ;
83+ assert . isTrue ( spy . calledWithNew ( ) ) ;
84+ assert . isTrue (
85+ spy . calledWith ( "xoxb-example-002" , {
86+ agent : undefined ,
87+ logger : config . logger ,
88+ retryConfig : webapi . retryPolicies . tenRetriesInAboutThirtyMinutes ,
89+ } ) ,
90+ ) ;
91+ } ) ;
6192 } ) ;
6293
6394 describe ( "success" , ( ) => {
0 commit comments