File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import HttpClientException from "../httpClient/httpClientException";
77import { binlookup } from "../typings" ;
88import { ApiConstants } from "../constants/apiConstants" ;
99import { paymentMethodsSuccess } from "../__mocks__/checkout/paymentMethodsSuccess" ;
10-
10+ import Config from "../config" ;
1111
1212beforeEach ( ( ) : void => {
1313 nock . cleanAll ( ) ;
@@ -177,4 +177,26 @@ describe("HTTP Client", function (): void {
177177 expect ( response . paymentMethods ) . toBeTruthy ( ) ;
178178 } ) ;
179179
180- } ) ;
180+ } ) ;
181+
182+ describe ( 'Config class' , ( ) => {
183+ const DEFAULT_TIMEOUT = 30000 ; // Define the default timeout value
184+
185+ test ( 'should set default timeout when no timeout is provided' , ( ) => {
186+ // Instantiate the Config class without passing a timeout
187+ const config = new Config ( ) ;
188+
189+ // Expect that the timeout is set to the default value (30000)
190+ expect ( config . connectionTimeoutMillis ) . toBe ( DEFAULT_TIMEOUT ) ;
191+ } ) ;
192+
193+ test ( 'should set custom timeout when provided' , ( ) => {
194+ // Instantiate the Config class with a custom timeout
195+ const customTimeout = 50000 ;
196+ const config = new Config ( { connectionTimeoutMillis : customTimeout } ) ;
197+
198+ // Expect that the timeout is set to the custom value (50000)
199+ expect ( config . connectionTimeoutMillis ) . toBe ( customTimeout ) ;
200+ } ) ;
201+ } ) ;
202+
You can’t perform that action at this time.
0 commit comments