Skip to content

Commit 6e5e1f4

Browse files
committed
Add more tests
1 parent 48e59ea commit 6e5e1f4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

calver-plugin-tests.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ describe('plugin', function () {
2020
const now = new Date();
2121
expect(incrementedVersion).to.equal(`${formatYear(now)}.${formatMonth(now)}.0`);
2222
});
23+
2324
it('should bump minor when incrementing twice in the same month', function () {
2425
const now = new Date();
2526
const incrementedVersion = new CalverPlugin().getIncrementedVersion({latestVersion: versionFromDate(now)});
@@ -35,6 +36,7 @@ describe('plugin', function () {
3536
const incrementedVersion = plugin.getIncrementedVersion({latestVersion});
3637
expect(incrementedVersion).to.equal(versionFromDate(before, 1));
3738
});
39+
3840
it('should accept a format option', function () {
3941
const now = new Date();
4042
const latestVersion = versionFromDate(now, 0, true);
@@ -45,11 +47,26 @@ describe('plugin', function () {
4547
});
4648

4749
it('should support alpha increment', function () {
48-
const now = new Date();
4950
const version = '2021.1.1.0-alpha.0';
5051
const plugin = new CalverPlugin();
5152
plugin.setContext({'increment': 'alpha', 'format': 'yyyy.mm.minor.patch'});
5253
const incrementedVersion = plugin.getIncrementedVersion({latestVersion: version});
5354
expect(incrementedVersion).to.equal('2021.1.1.0-alpha.1');
55+
});
56+
57+
it('should work by calling getIncrement()', function () {
58+
const version = '2021.1.1.0';
59+
const plugin = new CalverPlugin();
60+
plugin.setContext({'increment': 'minor', 'format': 'yyyy.mm.minor.patch'});
61+
const incrementedVersion = plugin.getIncrement({latestVersion: version});
62+
expect(incrementedVersion).to.equal('2021.1.2.0');
63+
});
64+
65+
it('should work by calling getIncrementedVersionCI()', function () {
66+
const version = '2021.1.1.0';
67+
const plugin = new CalverPlugin();
68+
plugin.setContext({'increment': 'minor', 'format': 'yyyy.mm.minor.patch'});
69+
const incrementedVersion = plugin.getIncrementedVersionCI({latestVersion: version});
70+
expect(incrementedVersion).to.equal('2021.1.2.0');
5471
});
5572
});

0 commit comments

Comments
 (0)