|
1
|
|
|
import { assert } from 'chai'; |
|
2
|
|
|
import Test from '../Test'; |
|
3
|
|
|
import { CLITester, getApiCalls, load } from '../utils'; |
|
4
|
|
|
|
|
5
|
|
|
const jiraRunner = load('bin/jira').default; |
|
6
|
|
|
|
|
7
|
|
|
const factory = new Test(); |
|
8
|
|
|
|
|
9
|
|
|
suite('cli jira list'); |
|
10
|
|
|
|
|
11
|
|
|
before(async function () { |
|
12
|
|
|
await factory.setTmpFolder(); |
|
13
|
|
|
await factory.saveProfile('jira_default', factory.jira_default); |
|
14
|
|
|
}); |
|
15
|
|
|
|
|
16
|
|
|
test('jira ls -dm', async function () { |
|
17
|
|
|
const tester = new CLITester([], factory); |
|
18
|
|
|
|
|
19
|
|
|
const [ output ] = await Promise.all([ |
|
20
|
|
|
tester.test(), |
|
21
|
|
|
jiraRunner([ 'ls', '-dm' ]) |
|
22
|
|
|
]); |
|
23
|
|
|
|
|
24
|
|
|
const apiCalls = await getApiCalls('type=requestSent'); |
|
25
|
|
|
|
|
26
|
|
|
assert.lengthOf(apiCalls, 2); |
|
27
|
|
|
apiCalls.forEach(req => { |
|
28
|
|
|
assert.equal(req.method, 'GET'); |
|
29
|
|
|
assert.equal(req.url, '/rest/api/3/search'); |
|
30
|
|
|
assert.equal( |
|
31
|
|
|
req.params.jql, |
|
32
|
|
|
'assignee was currentuser() AND status IN ("1", "2") AND Sprint in openSprints()' |
|
33
|
|
|
); |
|
34
|
|
|
}); |
|
35
|
|
|
const [ first, second ] = apiCalls; |
|
36
|
|
|
|
|
37
|
|
|
assert.notExists(first.params.startAt); |
|
38
|
|
|
assert.exists(second.params.startAt, 'second request for paggination'); |
|
39
|
|
|
|
|
40
|
|
|
assert.match(output, new RegExp('A-1.*brief tie pool present sharp')); |
|
41
|
|
|
assert.match(output, new RegExp('A-2.*symbol stock taste combine identity')); |
|
42
|
|
|
assert.match(output, new RegExp('A-3.*continent safe area fun especially end various love stick down balloon sense come our whispered old line environment trade')); |
|
43
|
|
|
}); |
|
44
|
|
|
|
|
45
|
|
|
after(async function () { |
|
46
|
|
|
await factory.cleanTmpFolder(); |
|
47
|
|
|
}); |
|
48
|
|
|
|