1 | const {
|
2 | mapNextReleaseVersion,
|
3 | mapLastReleaseVersionToLastReleaseGitTag,
|
4 | mapNextReleaseVersionToNextReleaseGitTag,
|
5 | mapCommits,
|
6 | } = require('./options-transforms');
|
7 |
|
8 | const OPTIONS = {
|
9 | commits: [1, 2, 3, 4],
|
10 | lastRelease: {
|
11 | version: '1.2.3',
|
12 | },
|
13 | nextRelease: {
|
14 | version: '4.5.6',
|
15 | },
|
16 | };
|
17 |
|
18 | const even = n => n % 2 === 0;
|
19 | const toTag = x => `tag-${x}`;
|
20 |
|
21 | describe('semantic-release plugin options transforms', () => {
|
22 | describe('#mapCommits', () => {
|
23 | it('allows mapping the "commits" option', async () => {
|
24 | const fn = commits => commits.filter(even);
|
25 |
|
26 | expect(await mapCommits(fn)(OPTIONS)).toEqual({
|
27 | ...OPTIONS,
|
28 | commits: [2, 4],
|
29 | });
|
30 | });
|
31 | });
|
32 |
|
33 | describe('#mapNextReleaseVersion', () => {
|
34 | it('maps the nextRelease.version option', async () => {
|
35 | expect(await mapNextReleaseVersion(toTag)(OPTIONS)).toEqual({
|
36 | ...OPTIONS,
|
37 | nextRelease: {
|
38 | version: 'tag-4.5.6',
|
39 | },
|
40 | });
|
41 | });
|
42 | });
|
43 | });
|