forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissueRemoteLinks.test.ts
34 lines (29 loc) · 995 Bytes
/
issueRemoteLinks.test.ts
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
34
import * as sinon from 'sinon';
import { test } from 'vitest';
import { IssueRemoteLinks, Version2Client } from '@jirajs/version2';
const client = new Version2Client({ host: 'http://localhost' });
const sendRequestStub = sinon.stub(client, 'sendRequest');
const issueRemoteLinks = new IssueRemoteLinks(client);
test('createOrUpdateRemoteIssueLink should accept follow parameters', ({ expect }) => {
issueRemoteLinks.createOrUpdateRemoteIssueLink({
issueIdOrKey: 'issue.key',
object: {
url: 'http://localhost/',
title: 'Title',
icon: {},
},
});
expect(sendRequestStub.calledOnce).toBeTruthy();
const callArgument = sendRequestStub.getCall(0).args[0];
expect(callArgument.url).toBe('/rest/api/2/issue/issue.key/remotelink');
expect(callArgument.data).toStrictEqual({
application: undefined,
globalId: undefined,
relationship: undefined,
object: {
url: 'http://localhost/',
title: 'Title',
icon: {},
},
});
});