mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
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:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user