|
5 | 5 | * @jest-environment ./integration-test-environment |
6 | 6 | */ |
7 | 7 |
|
| 8 | +import { HTTPError } from '@supaglue/schemas'; |
8 | 9 | import type { |
9 | 10 | CreateContactRequest, |
10 | 11 | CreateContactResponse, |
@@ -92,17 +93,18 @@ describe('sequence', () => { |
92 | 93 | test(`Error body`, async () => { |
93 | 94 | testSequence.steps[0].interval_seconds = 123; |
94 | 95 |
|
95 | | - const res = await supaglueClient.engagement.POST('/sequences', { |
96 | | - body: { record: testSequence }, |
97 | | - // TODO: Make it so that x-customer-id can be omitted if it was passed into the client at creation time. |
98 | | - params: { header: { 'x-provider-name': 'salesloft', 'x-customer-id': process.env.CUSTOMER_ID! } }, |
99 | | - }); |
| 96 | + const res = (await supaglueClient.engagement |
| 97 | + .POST('/sequences', { |
| 98 | + body: { record: testSequence }, |
| 99 | + // TODO: Make it so that x-customer-id can be omitted if it was passed into the client at creation time. |
| 100 | + params: { header: { 'x-provider-name': 'salesloft', 'x-customer-id': process.env.CUSTOMER_ID! } }, |
| 101 | + }) |
| 102 | + .catch((e) => e as HTTPError<unknown>)) as HTTPError<unknown>; |
100 | 103 |
|
| 104 | + expect(res).toBeInstanceOf(HTTPError); |
101 | 105 | expect(res.response.status).toEqual(400); |
102 | 106 | // Our API spec is wrong and should specify 400 return code with ability to have errors |
103 | | - expect((res.error as typeof res.data)?.errors?.[0].title).toMatch( |
104 | | - 'Salesloft only supports intervals in whole days' |
105 | | - ); |
| 107 | + expect((res.error as any)?.errors?.[0].title).toMatch('Salesloft only supports intervals in whole days'); |
106 | 108 | }); |
107 | 109 |
|
108 | 110 | describe.each(['outreach', 'apollo', 'salesloft'])('%s', (providerName) => { |
|
0 commit comments