Skip to content

Commit 257fe3b

Browse files
committed
chore: reduce to basic test for testing the codegen types, not the rest client
1 parent 90aa8cc commit 257fe3b

File tree

1 file changed

+6
-49
lines changed

1 file changed

+6
-49
lines changed

__tests__/test1.test.ts

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,14 @@
11
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';
73
import { BillingServiceRestApiRestClient } from './fixtures/test1/main.js';
8-
import { BillingCountry, type BillingAccount } from './fixtures/test1/types.js';
94

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'));
317
const command = new GetBillingAccountCommand({
32-
billingAccountId: '5678',
8+
billingAccountId: '1234',
339
});
3410

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);
4912

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();
5714
});

0 commit comments

Comments
 (0)