Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

cliVersion.test.ts

17 lines569 Bytes

1import { assert, describe, it } from "@effect/vitest";
2​
3import { compareCliVersions, normalizeCliVersion } from "./cliVersion.ts";
4​
5describe("cliVersion", () => {
6 it("normalizes versions with a missing patch segment", () => {
7 assert.strictEqual(normalizeCliVersion("2.1"), "2.1.0");
8 });
9​
10 it("compares prerelease versions before stable versions", () => {
11 assert.isTrue(compareCliVersions("2.1.111-beta.1", "2.1.111") < 0);
12 });
13​
14 it("rejects malformed numeric segments", () => {
15 assert.isTrue(compareCliVersions("1.2.3abc", "1.2.10") > 0);
16 });
17});