-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reduce to basic test for testing the codegen types, not the re…
…st client
- Loading branch information
Showing
1 changed file
with
6 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,14 @@ | ||
import { test } from '@jest/globals'; | ||
import { | ||
GetBillingAccountCommand, | ||
LinkBillingAccountCommand, | ||
UpdateBillingAccountCommand, | ||
} from './fixtures/test1/commands.js'; | ||
import { GetBillingAccountCommand } from './fixtures/test1/commands.js'; | ||
import { BillingServiceRestApiRestClient } from './fixtures/test1/main.js'; | ||
import { BillingCountry, type BillingAccount } from './fixtures/test1/types.js'; | ||
|
||
const test1Client = new BillingServiceRestApiRestClient( | ||
new URL('http://invalid'), | ||
); | ||
|
||
test('command that will result in a void response', async () => { | ||
const command = new LinkBillingAccountCommand({ | ||
accountId: '1234', | ||
billingAccountId: '5678', | ||
}); | ||
|
||
try { | ||
const res = await test1Client.json(command); | ||
|
||
// @ts-expect-error | ||
const typeTest: void = res; | ||
} catch (err) { | ||
console.log(Object(err).message); | ||
} | ||
}); | ||
|
||
test('command without a body', async () => { | ||
test('Test1 GetBillingAccount', async () => { | ||
const client = new BillingServiceRestApiRestClient(new URL('http://invalid')); | ||
const command = new GetBillingAccountCommand({ | ||
billingAccountId: '5678', | ||
billingAccountId: '1234', | ||
}); | ||
|
||
try { | ||
const res: BillingAccount = await test1Client.json(command); | ||
|
||
const billingAccountId: string = res.billingAccountId; | ||
} catch (err) { | ||
console.log(Object(err).message); | ||
} | ||
}); | ||
|
||
test('command with a body', async () => { | ||
const command = new UpdateBillingAccountCommand({ | ||
billingAccountId: '5678', | ||
country: BillingCountry.Sg, | ||
}); | ||
const result = await client.json(command).catch((err) => err); | ||
|
||
try { | ||
const res = await test1Client.json(command); | ||
// @ts-expect-error | ||
const billingAccountId: string = res.billingAccountId; | ||
} catch (err) { | ||
console.log(Object(err).message); | ||
} | ||
expect(result).toBeTruthy(); | ||
}); |