-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathanalyze-commits.test.js
More file actions
74 lines (69 loc) Β· 2.13 KB
/
Copy pathanalyze-commits.test.js
File metadata and controls
74 lines (69 loc) Β· 2.13 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const test = require('ava')
const { analyzeCommits } = require('../..')
const getContext = require('./fixtures/contexts')
const CASES = [
{
name: 'default config + common context w/o updates',
pluginConfig: {},
context: getContext('common', { commits: { boring: 2 } }),
expectedRelease: undefined
},
{
name: 'default config + common context w/ patch updates',
pluginConfig: {},
context: getContext('common', { commits: { boring: 2, patch: 4 } }),
expectedRelease: 'patch'
},
{
name: 'default config + common context w/ minor updates',
pluginConfig: {},
context: getContext('common', { commits: { boring: 2, patch: 4, minor: 2 } }),
expectedRelease: 'minor'
},
{
name: 'default config + common context w/ major updates',
pluginConfig: {},
context: getContext('common', { commits: { boring: 2, patch: 4, minor: 2, major: 1 } }),
expectedRelease: 'major'
},
{
name: 'default config + common context w/o updates using gitmoji semver',
pluginConfig: {
semver: true
},
context: getContext('common', { commits: { boring: 2 } }),
expectedRelease: undefined
},
{
name: 'default config + common context w/ patch updates using gitmoji semver',
pluginConfig: {
semver: true
},
context: getContext('common', { commits: { boring: 2, patch: 4 } }),
expectedRelease: 'patch'
},
{
name: 'default config + common context w/ minor updates using gitmoji semver',
pluginConfig: {
semver: true
},
context: getContext('common', { commits: { boring: 2, patch: 4, minor: 2 } }),
expectedRelease: 'minor'
},
{
name: 'default config + common context w/ major updates using gitmoji semver',
pluginConfig: {
semver: true
},
context: getContext('common', { commits: { boring: 2, patch: 4, minor: 2, major: 1 } }),
expectedRelease: 'major'
}
]
async function macro (t, { pluginConfig, context, expectedRelease }) {
context.logger.log = t.log
t.is(await analyzeCommits(pluginConfig, context), expectedRelease)
}
macro.title = function title (t, { name }) {
return name
}
CASES.forEach(c => test(macro, c))