-
-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathwebhooks.test.js
33 lines (28 loc) · 886 Bytes
/
webhooks.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import path from 'node:path';
import dotenv from 'dotenv';
import {back as nockBack} from 'nock';
import {beforeAll, describe, expect, it} from 'vitest';
import {setupClient} from './setup.js';
dotenv.config();
describe('Zendesk Client Webhooks', () => {
const client = setupClient();
beforeAll(async () => {
nockBack.setMode('record');
nockBack.fixtures = path.join(__dirname, '/fixtures');
});
it('should call endpoint without .json', async () => {
const {nockDone} = await nockBack('webhooks_endpoint.json');
const {result} = await client.webhooks.create({
webhook: {
name: `Web Hulk`,
endpoint: 'noop://noop',
http_method: 'POST',
request_format: 'json',
status: 'active',
subscriptions: ['conditional_ticket_events'],
},
});
nockDone();
expect(result.id).toBeDefined();
});
});