File tree 1 file changed +24
-2
lines changed
1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import HttpClientException from "../httpClient/httpClientException";
7
7
import { binlookup } from "../typings" ;
8
8
import { ApiConstants } from "../constants/apiConstants" ;
9
9
import { paymentMethodsSuccess } from "../__mocks__/checkout/paymentMethodsSuccess" ;
10
-
10
+ import Config from "../config" ;
11
11
12
12
beforeEach ( ( ) : void => {
13
13
nock . cleanAll ( ) ;
@@ -177,4 +177,26 @@ describe("HTTP Client", function (): void {
177
177
expect ( response . paymentMethods ) . toBeTruthy ( ) ;
178
178
} ) ;
179
179
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