|
1 | 1 | import { test } from '@jest/globals'; |
2 | | -import { |
3 | | - GetBillingAccountCommand, |
4 | | - LinkBillingAccountCommand, |
5 | | - UpdateBillingAccountCommand, |
6 | | -} from './fixtures/test1/commands.js'; |
| 2 | +import { GetBillingAccountCommand } from './fixtures/test1/commands.js'; |
7 | 3 | import { BillingServiceRestApiRestClient } from './fixtures/test1/main.js'; |
8 | | -import { BillingCountry, type BillingAccount } from './fixtures/test1/types.js'; |
9 | 4 |
|
10 | | -const test1Client = new BillingServiceRestApiRestClient( |
11 | | - new URL('http://invalid'), |
12 | | -); |
13 | | - |
14 | | -test('command that will result in a void response', async () => { |
15 | | - const command = new LinkBillingAccountCommand({ |
16 | | - accountId: '1234', |
17 | | - billingAccountId: '5678', |
18 | | - }); |
19 | | - |
20 | | - try { |
21 | | - const res = await test1Client.json(command); |
22 | | - |
23 | | - // @ts-expect-error |
24 | | - const typeTest: void = res; |
25 | | - } catch (err) { |
26 | | - console.log(Object(err).message); |
27 | | - } |
28 | | -}); |
29 | | - |
30 | | -test('command without a body', async () => { |
| 5 | +test('Test1 GetBillingAccount', async () => { |
| 6 | + const client = new BillingServiceRestApiRestClient(new URL('http://invalid')); |
31 | 7 | const command = new GetBillingAccountCommand({ |
32 | | - billingAccountId: '5678', |
| 8 | + billingAccountId: '1234', |
33 | 9 | }); |
34 | 10 |
|
35 | | - try { |
36 | | - const res: BillingAccount = await test1Client.json(command); |
37 | | - |
38 | | - const billingAccountId: string = res.billingAccountId; |
39 | | - } catch (err) { |
40 | | - console.log(Object(err).message); |
41 | | - } |
42 | | -}); |
43 | | - |
44 | | -test('command with a body', async () => { |
45 | | - const command = new UpdateBillingAccountCommand({ |
46 | | - billingAccountId: '5678', |
47 | | - country: BillingCountry.Sg, |
48 | | - }); |
| 11 | + const result = await client.json(command).catch((err) => err); |
49 | 12 |
|
50 | | - try { |
51 | | - const res = await test1Client.json(command); |
52 | | - // @ts-expect-error |
53 | | - const billingAccountId: string = res.billingAccountId; |
54 | | - } catch (err) { |
55 | | - console.log(Object(err).message); |
56 | | - } |
| 13 | + expect(result).toBeTruthy(); |
57 | 14 | }); |
0 commit comments