tree-wide: fix version comparison

We were using satisfies in a few places where we should have just been
using a comparison operator.
This commit is contained in:
David Lechner
2022-12-20 15:39:26 -06:00
parent 25231012f6
commit b366f777ca
3 changed files with 16 additions and 10 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
// Copyright (c) 2021-2022 The Pybricks Authors
import { lt } from 'semver';
import { pythonVersionToSemver } from './version';
describe('pythonVersionToSemver', () => {
@@ -14,6 +15,16 @@ describe('pythonVersionToSemver', () => {
expect(pythonVersionToSemver(version)).toBe(expected);
});
test.each([
['v1.0.0a1', 'v1.0.0b1'],
['v1.0.0b1', 'v1.0.0c1'],
['v1.0.0c1', 'v1.0.0'],
])('%s < %s', (first, second) => {
expect(
lt(pythonVersionToSemver(first), pythonVersionToSemver(second)),
).toBeTruthy();
});
test('invalid version', () => {
expect(() => pythonVersionToSemver('not a version')).toThrow();
});