forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissueComments.test.ts
34 lines (29 loc) · 1009 Bytes
/
issueComments.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 { IssueComments, Version2Client } from '@jirajs/version2';
const client = new Version2Client({ host: 'http://localhost' });
const sendRequestStub = sinon.stub(client, 'sendRequest');
const issueComments = new IssueComments(client);
test('addComment should accept follow parameters', ({ expect }) => {
issueComments.addComment({
issueIdOrKey: 'key',
comment: 'test comment',
});
expect(sendRequestStub.calledOnce).toBeTruthy();
const callArgument = sendRequestStub.getCall(0).args[0];
expect(callArgument.url).toBe('/rest/api/2/issue/key/comment');
expect(callArgument.data).toStrictEqual({
body: 'test comment',
author: undefined,
created: undefined,
id: undefined,
jsdAuthorCanSeeRequest: undefined,
jsdPublic: undefined,
properties: undefined,
renderedBody: undefined,
self: undefined,
updateAuthor: undefined,
updated: undefined,
visibility: undefined,
});
});