-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathoptions-transforms.spec.js
More file actions
38 lines (33 loc) · 915 Bytes
/
Copy pathoptions-transforms.spec.js
File metadata and controls
38 lines (33 loc) · 915 Bytes
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
const { mapNextReleaseVersion, mapCommits } = require('./options-transforms');
const OPTIONS = {
commits: [1, 2, 3, 4],
lastRelease: {
version: '1.2.3',
},
nextRelease: {
version: '4.5.6',
},
};
const even = n => n % 2 === 0;
const toTag = x => `tag-${x}`;
describe('semantic-release plugin options transforms', () => {
describe('#mapCommits', () => {
it('allows mapping the "commits" option', async () => {
const fn = commits => commits.filter(even);
await expect(mapCommits(fn)(OPTIONS)).resolves.toEqual({
...OPTIONS,
commits: [2, 4],
});
});
});
describe('#mapNextReleaseVersion', () => {
it('maps the nextRelease.version option', async () => {
await expect(mapNextReleaseVersion(toTag)(OPTIONS)).resolves.toEqual({
...OPTIONS,
nextRelease: {
version: 'tag-4.5.6',
},
});
});
});
});