Skip to content

Commit

Permalink
test: expand tests for caret versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hussainweb committed Apr 29, 2020
1 parent 77745e7 commit c47e2fc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/versioning/composer/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ describe('semver.getNewValue()', () => {
toVersion: 'V1.1',
})
).toEqual('V1.1');
expect(
semver.getNewValue({
currentValue: '^1.0',
rangeStrategy: 'pin',
fromVersion: '1.0',
toVersion: 'V1.1',
})
).toEqual('V1.1');
});
it('returns toVersion', () => {
expect(
Expand All @@ -190,6 +198,36 @@ describe('semver.getNewValue()', () => {
})
).toEqual('^1.0');
});
it('bumps caret to same', () => {
expect(
semver.getNewValue({
currentValue: '^1.0.0',
rangeStrategy: 'bump',
fromVersion: '1.0.0',
toVersion: '1.3.5',
})
).toEqual('^1.0');
});
it('replaces caret to same', () => {
expect(
semver.getNewValue({
currentValue: '^1.0.0',
rangeStrategy: 'replace',
fromVersion: '1.0.0',
toVersion: '1.3.5',
})
).toEqual('^1.0');
});
it('replaces short caret', () => {
expect(
semver.getNewValue({
currentValue: '^1.0',
rangeStrategy: 'replace',
fromVersion: '1.0.0',
toVersion: '2.3.5',
})
).toEqual('^2.0');
});
it('handles tilde zero', () => {
expect(
semver.getNewValue({
Expand Down

0 comments on commit c47e2fc

Please sign in to comment.