|
1 | 1 | import Client from "../client";
|
2 | 2 |
|
3 | 3 | describe("API Client", function (): void {
|
4 |
| - test("should be able to make a request using basic auth", async function (): Promise<void> { |
5 |
| - new Client({ |
6 |
| - username: process.env.ADYEN_USER!, |
7 |
| - password: process.env.ADYEN_PASSWORD!, |
8 |
| - environment: "TEST" |
9 |
| - }); |
| 4 | + test("should be able to make a request using basic auth", async function (): Promise<void> { |
| 5 | + new Client({ |
| 6 | + username: process.env.ADYEN_USER!, |
| 7 | + password: process.env.ADYEN_PASSWORD!, |
| 8 | + environment: "TEST" |
10 | 9 | });
|
| 10 | + }); |
| 11 | + |
| 12 | + test("should create client with API key", () => { |
| 13 | + const client = new Client({ |
| 14 | + apiKey: "ADYEN_API_KEY", |
| 15 | + environment: "TEST" |
| 16 | + }); |
| 17 | + |
| 18 | + expect(client.config.apiKey).toBe("ADYEN_API_KEY"); |
| 19 | + expect(client.config.environment).toBe("TEST"); |
| 20 | + expect(client.config.marketPayEndpoint).toBe(Client.MARKETPAY_ENDPOINT_TEST); |
| 21 | + }); |
| 22 | + |
| 23 | + test("should create client with basic auth credentials", () => { |
| 24 | + const client = new Client({ |
| 25 | + username: "username", |
| 26 | + password: "password", |
| 27 | + environment: "TEST" |
| 28 | + }); |
| 29 | + |
| 30 | + expect(client.config.username).toBe("username"); |
| 31 | + expect(client.config.password).toBe("password"); |
| 32 | + expect(client.config.environment).toBe("TEST"); |
| 33 | + }); |
| 34 | + |
| 35 | + test("should set application name", () => { |
| 36 | + const client = new Client({ |
| 37 | + apiKey: "ADYEN_API_KEY", |
| 38 | + environment: "TEST", |
| 39 | + applicationName: "my_application_name" |
| 40 | + }); |
| 41 | + |
| 42 | + expect(client.config.applicationName).toBe("my_application_name"); |
| 43 | + }); |
| 44 | + |
| 45 | + test("should set timeout", () => { |
| 46 | + const client = new Client({ |
| 47 | + apiKey: "ADYEN_API_KEY", |
| 48 | + environment: "TEST" |
| 49 | + }); |
| 50 | + |
| 51 | + client.setTimeouts(30000); |
| 52 | + expect(client.config.connectionTimeoutMillis).toBe(30000); |
| 53 | + }); |
11 | 54 | });
|
0 commit comments