Skip to content
Snippets Groups Projects
Unverified Commit 8e0c2861 authored by Sergei Zharinov's avatar Sergei Zharinov Committed by GitHub
Browse files

refactor(npm): More tests for 'replace' strategy (#8991)

parent 0c96aa6d
No related branches found
No related tags found
No related merge requests found
...@@ -71,14 +71,29 @@ describe('semver.getNewValue()', () => { ...@@ -71,14 +71,29 @@ describe('semver.getNewValue()', () => {
).toEqual('^1.0.7-prerelease.1'); ).toEqual('^1.0.7-prerelease.1');
}); });
it('replaces with newer', () => { it('replaces with newer', () => {
expect( [
semver.getNewValue({ ['^0.0.3', '0.0.6', '^0.0.6'],
currentValue: '^1.0.0', ['^0.0.3', '0.5.0', '^0.5.0'],
rangeStrategy: 'replace', ['^0.0.3', '0.5.6', '^0.5.0'],
currentVersion: '1.0.0', ['^0.0.3', '4.0.0', '^4.0.0'],
newVersion: '1.0.7', ['^0.0.3', '4.0.6', '^4.0.0'],
}) ['^0.0.3', '4.5.6', '^4.0.0'],
).toEqual('^1.0.7'); ['^0.2.0', '0.5.6', '^0.5.0'],
['^0.2.3', '0.5.0', '^0.5.0'],
['^0.2.3', '0.5.6', '^0.5.0'],
['^1.2.3', '4.0.0', '^4.0.0'],
['^1.2.3', '4.5.6', '^4.0.0'],
['^1.0.0', '4.5.6', '^4.0.0'],
].forEach(([currentValue, newVersion, expectedValue]) => {
expect(
semver.getNewValue({
currentValue,
rangeStrategy: 'replace',
currentVersion: currentValue.replace('^', ''),
newVersion,
})
).toEqual(expectedValue);
});
}); });
it('supports tilde greater than', () => { it('supports tilde greater than', () => {
expect( expect(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment