Skip to content
Snippets Groups Projects
Unverified Commit bc2e4b38 authored by RahulGautamSingh's avatar RahulGautamSingh Committed by GitHub
Browse files

test(pep440): add tests (#28915)

parent 468b0d14
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ describe('modules/versioning/pep440/index', () => {
${'1.9'} | ${true}
${'17.04.0'} | ${true}
${'==1.2.3'} | ${true}
${'==1.2.3.0'} | ${true}
${'==1.2.3rc0'} | ${true}
${'~=1.2.3'} | ${true}
${'==1.2.*'} | ${true}
......@@ -38,9 +39,10 @@ describe('modules/versioning/pep440/index', () => {
});
it.each`
a | b | expected
${'1.0'} | ${'>=1.0.0'} | ${true}
${'>=3.8'} | ${'>=3.9'} | ${false}
a | b | expected
${'1.0'} | ${'>=1.0.0'} | ${true}
${'1.6.2'} | ${'<2.2.1.0'} | ${true}
${'>=3.8'} | ${'>=3.9'} | ${false}
`('matches($a, $b) === $expected', ({ a, b, expected }) => {
expect(pep440.matches(a, b)).toBe(expected);
});
......
......@@ -20,7 +20,7 @@ describe('util/package-rules/current-version', () => {
});
it('return false on version exception', () => {
const spy = jest.spyOn(pep440, 'matches').mockImplementationOnce(() => {
const spy = jest.spyOn(pep440, 'isValid').mockImplementationOnce(() => {
throw new Error();
});
const result = matcher.matches(
......@@ -36,6 +36,19 @@ describe('util/package-rules/current-version', () => {
expect(spy.mock.calls).toHaveLength(1);
});
it('return true for a valid match', () => {
const result = matcher.matches(
{
versioning: 'pep440',
currentValue: '1.2.3',
},
{
matchCurrentVersion: '<1.2.3.5',
},
);
expect(result).toBeTrue();
});
it('return false if no version could be found', () => {
const result = matcher.matches(
{
......
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