From 257fe3b96cf37597f45f5aa5b39ef2c1e2f58f73 Mon Sep 17 00:00:00 2001 From: Max Holman Date: Thu, 11 May 2023 16:42:17 +0800 Subject: [PATCH] chore: reduce to basic test for testing the codegen types, not the rest client --- __tests__/test1.test.ts | 55 +++++------------------------------------ 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/__tests__/test1.test.ts b/__tests__/test1.test.ts index 62c1e7e..18fdf5a 100644 --- a/__tests__/test1.test.ts +++ b/__tests__/test1.test.ts @@ -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(); });