forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappMigration.test.ts
32 lines (26 loc) · 985 Bytes
/
appMigration.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
import * as sinon from 'sinon';
import { test } from 'vitest';
import { Version2Client } from '@jirajs';
const entity = {
entityId: 1,
key: 'k',
value: 'v',
};
const config = { host: 'http://localhost' };
test('updateEntityPropertiesValue should accept actual parameters', ({ expect }) => {
const client = new Version2Client(config);
const sendRequestStub = sinon.stub(client, 'sendRequest');
client.appMigration.updateEntityPropertiesValue({
entityType: '1',
transferId: '2',
accountId: '3',
entities: [entity],
});
const callArgument = sendRequestStub.getCall(0).args[0];
expect(sendRequestStub.calledOnce).toBeTruthy();
expect(callArgument.url!.endsWith('1')).toBeTruthy();
expect(callArgument.headers!['Atlassian-Transfer-Id']).toBe('2');
expect(callArgument.headers!['Atlassian-Account-Id']).toBe('3');
expect(callArgument.headers!['Content-Type']).toBe('application/json');
expect(callArgument.data).toStrictEqual([entity]);
});