diff --git a/lib/modules/versioning/pep440/index.spec.ts b/lib/modules/versioning/pep440/index.spec.ts index 8ba12022fb4f46a1df22a90c92624df8135b843b..c9c024ac259f447d21b6b5932039f9576b76ba03 100644 --- a/lib/modules/versioning/pep440/index.spec.ts +++ b/lib/modules/versioning/pep440/index.spec.ts @@ -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); }); diff --git a/lib/util/package-rules/current-version.spec.ts b/lib/util/package-rules/current-version.spec.ts index d8b8ee034df1a4078fe314f4b1c4d82f23036fc4..07a4ba1dfc922995f524b771615785ca4f3a21ba 100644 --- a/lib/util/package-rules/current-version.spec.ts +++ b/lib/util/package-rules/current-version.spec.ts @@ -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( {