Skip to content

Commit 21d08ae

Browse files
committed
Add test
1 parent ceae75d commit 21d08ae

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/__tests__/httpClient.spec.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ApiException from "../services/exception/apiException";
66
import HttpClientException from "../httpClient/httpClientException";
77
import { binlookup } from "../typings";
88
import { ApiConstants } from "../constants/apiConstants";
9+
import Config from "../config";
910

1011
beforeEach((): void => {
1112
nock.cleanAll();
@@ -100,4 +101,26 @@ describe("HTTP Client", function (): void {
100101
expect(response).toEqual< binlookup.ThreeDSAvailabilityResponse>(threeDSAvailabilitySuccessResponse);
101102
});
102103

103-
});
104+
});
105+
106+
describe('Config class', () => {
107+
const DEFAULT_TIMEOUT = 30000; // Define the default timeout value
108+
109+
test('should set default timeout when no timeout is provided', () => {
110+
// Instantiate the Config class without passing a timeout
111+
const config = new Config();
112+
113+
// Expect that the timeout is set to the default value (30000)
114+
expect(config.connectionTimeoutMillis).toBe(DEFAULT_TIMEOUT);
115+
});
116+
117+
test('should set custom timeout when provided', () => {
118+
// Instantiate the Config class with a custom timeout
119+
const customTimeout = 50000;
120+
const config = new Config({ connectionTimeoutMillis: customTimeout });
121+
122+
// Expect that the timeout is set to the custom value (50000)
123+
expect(config.connectionTimeoutMillis).toBe(customTimeout);
124+
});
125+
});
126+

0 commit comments

Comments
 (0)