Skip to content

Commit

Permalink
release v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
snyamathi committed Dec 1, 2023
1 parent 443182c commit 2b963ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "semver-intersect",
"version": "1.4.0",
"version": "1.5.0",
"description": "Get the intersection of multiple semver ranges",
"keywords": [
"semver"
Expand Down Expand Up @@ -31,4 +31,4 @@
"eslint": "^6.8.0",
"jest": "^25.4.0"
}
}
}
20 changes: 20 additions & 0 deletions tests/unit/semver-intersect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@ describe('intersect', () => {
const result = intersect('^4.0.0', '~4.3.0');
expect(result).toEqual('~4.3.0');
});
it('should intersect an x range and tilde range', () => {
const result = intersect('4.x', '~4.3.0');
expect(result).toEqual('~4.3.0');
});
it('should intersect an or range and tilde range', () => {
const result = intersect('^4.1.2 || ^5.2.3', '~4.3.0');
expect(result).toEqual('~4.3.0');
});
it('should intersect a wildcard range', () => {
const result = intersect('1.*', '~1.3.0');
expect(result).toEqual('~1.3.0');
});
it('should intersect two or ranges', () => {
const result = intersect('^4.0.0 || ^5.1.2', '^4.1.2 || ^5.0.0');
expect(result).toEqual('^4.1.2 || ^5.1.2');
});
it('should handle pre-release versions mixed with versions', () => {
const result = intersect('^1.0.0-alpha.3', '^1.2.0');
expect(result).toEqual('^1.2.0');
Expand Down Expand Up @@ -199,6 +215,10 @@ describe('intersect', () => {
const call = intersect.bind(null, '^4.0.0', '~4.3.0', '^4.4.0');
expect(call).toThrow('Range >=4.4.0 is not compatible with <4.4.0');
});
it('should throw if or range cannot be satisfied', () => {
const call = intersect.bind(null, '^1.0.0 || ^3.0.0', '^2.0.0');
expect(call).toThrow('Range >=2.0.0 is not compatible with <2.0.0');
});
it('should simplify issue 12', () => {
const result = intersect('1.0.0 - 1.5.3');
expect(result).toEqual('1.0.0 - 1.5.3');
Expand Down

0 comments on commit 2b963ff

Please sign in to comment.