Skip to content

Commit 6f39c1e

Browse files
author
Matthew Carroll
committed
Add test for setting the external_id parameter
1 parent b77e0f7 commit 6f39c1e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/management/jobs.test.ts

+27
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,33 @@ describe('JobsManager', () => {
373373
});
374374
});
375375

376+
it('should set the `external_id` parameter correctly', (done) => {
377+
nock.cleanAll();
378+
let boundary: string | null = null;
379+
const external_id = 'some_job_correlation_id';
380+
381+
const request = nock(API_URL)
382+
.matchHeader('Content-Type', (header) => {
383+
boundary = `--${header.match(/boundary=([^\n]*)/)?.[1]}`;
384+
385+
return true;
386+
})
387+
.post('/jobs/users-imports', (body) => {
388+
const parts = extractParts(body, boundary);
389+
390+
expect(parts.external_id).toBe(external_id);
391+
392+
return true;
393+
})
394+
.reply(200, {});
395+
396+
jobs.importUsers(Object.assign({}, data, { external_id })).then(() => {
397+
expect(request.isDone()).toBe(true);
398+
399+
done();
400+
});
401+
});
402+
376403
it('should include the token in the Authorization header', (done) => {
377404
nock.cleanAll();
378405

0 commit comments

Comments
 (0)