mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-05 20:38:22 +00:00
* feat: add standalone binary releases * fix: propagate async CLI failures * fix: detect older Bun standalone builds * fix: constrain npm package contents * fix: preserve npm daemon entrypoint * fix: compare prerelease versions correctly * fix: verify daemon ownership before update restart * docs: add release and PM2 migration guidance * ci: validate standalone builds before release * chore: prepare v0.4.9 release --------- Co-authored-by: hzrd149, redshift <213178690+1ftredsh@users.noreply.github.com>
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { compareVersions } from "../../src/utils/update-checker";
|
|
|
|
describe("compareVersions", () => {
|
|
test("compares stable semantic versions", () => {
|
|
expect(compareVersions("0.5.1", "0.5.0")).toBeGreaterThan(0);
|
|
expect(compareVersions("v0.5.0", "0.5.0")).toBe(0);
|
|
expect(compareVersions("0.4.9", "0.5.0")).toBeLessThan(0);
|
|
});
|
|
|
|
test("orders prereleases before the corresponding stable release", () => {
|
|
expect(compareVersions("0.5.0-beta.1", "0.5.0")).toBeLessThan(0);
|
|
expect(compareVersions("0.5.0", "0.5.0-rc.1")).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("uses semantic-version precedence for prerelease identifiers", () => {
|
|
expect(compareVersions("0.5.0-beta.2", "0.5.0-beta.11")).toBeLessThan(0);
|
|
expect(compareVersions("0.5.0-beta.11", "0.5.0-rc.1")).toBeLessThan(0);
|
|
expect(compareVersions("0.5.0-rc.1", "0.5.0-rc.1.1")).toBeLessThan(0);
|
|
});
|
|
|
|
test("ignores build metadata and rejects malformed versions", () => {
|
|
expect(compareVersions("0.5.0+darwin", "0.5.0+linux")).toBe(0);
|
|
expect(compareVersions("0.5.0garbage", "0.5.0")).toBeNull();
|
|
});
|
|
});
|