summaryrefslogtreecommitdiffhomepage
path: root/packages/kernel/src/host/version.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-26 22:03:19 +0900
committerAdam Malczewski <[email protected]>2026-06-26 22:23:39 +0900
commit727c98c9dae516a2070eb950410314380a20c974 (patch)
tree52aa1022c54f11770be7e4e2a324f0a8b8b8deec /packages/kernel/src/host/version.test.ts
parente59dc11f63b1df51142259bb2c406af8c9c8c2bb (diff)
downloaddispatch-727c98c9dae516a2070eb950410314380a20c974.tar.gz
dispatch-727c98c9dae516a2070eb950410314380a20c974.zip
style: switch from tabs to 2-space indentation
Diffstat (limited to 'packages/kernel/src/host/version.test.ts')
-rw-r--r--packages/kernel/src/host/version.test.ts190
1 files changed, 95 insertions, 95 deletions
diff --git a/packages/kernel/src/host/version.test.ts b/packages/kernel/src/host/version.test.ts
index 85002b6..8325c5e 100644
--- a/packages/kernel/src/host/version.test.ts
+++ b/packages/kernel/src/host/version.test.ts
@@ -2,99 +2,99 @@ import { describe, expect, it } from "vitest";
import { isApiVersionCompatible } from "./version.js";
describe("isApiVersionCompatible", () => {
- describe("wildcard", () => {
- it("matches any version", () => {
- expect(isApiVersionCompatible("*", "0.1.0")).toBe(true);
- expect(isApiVersionCompatible("*", "1.0.0")).toBe(true);
- expect(isApiVersionCompatible("*", "99.99.99")).toBe(true);
- });
- });
-
- describe("exact match", () => {
- it("matches identical version", () => {
- expect(isApiVersionCompatible("0.1.0", "0.1.0")).toBe(true);
- });
-
- it("rejects different patch", () => {
- expect(isApiVersionCompatible("0.1.0", "0.1.1")).toBe(false);
- });
-
- it("rejects different minor", () => {
- expect(isApiVersionCompatible("0.1.0", "0.2.0")).toBe(false);
- });
-
- it("rejects different major", () => {
- expect(isApiVersionCompatible("1.0.0", "2.0.0")).toBe(false);
- });
- });
-
- describe("caret range (^)", () => {
- it("0.x: allows same minor, higher patch", () => {
- expect(isApiVersionCompatible("^0.1.0", "0.1.0")).toBe(true);
- expect(isApiVersionCompatible("^0.1.0", "0.1.5")).toBe(true);
- expect(isApiVersionCompatible("^0.1.0", "0.1.99")).toBe(true);
- });
-
- it("0.x: rejects different minor", () => {
- expect(isApiVersionCompatible("^0.1.0", "0.2.0")).toBe(false);
- expect(isApiVersionCompatible("^0.1.0", "0.0.9")).toBe(false);
- });
-
- it("0.x: rejects different major", () => {
- expect(isApiVersionCompatible("^0.1.0", "1.0.0")).toBe(false);
- });
-
- it("1.x+: allows same major, higher minor/patch", () => {
- expect(isApiVersionCompatible("^1.2.0", "1.2.0")).toBe(true);
- expect(isApiVersionCompatible("^1.2.0", "1.3.0")).toBe(true);
- expect(isApiVersionCompatible("^1.2.0", "1.99.0")).toBe(true);
- });
-
- it("1.x+: rejects next major", () => {
- expect(isApiVersionCompatible("^1.2.0", "2.0.0")).toBe(false);
- });
-
- it("rejects below minimum", () => {
- expect(isApiVersionCompatible("^1.2.3", "1.2.2")).toBe(false);
- expect(isApiVersionCompatible("^1.2.3", "1.1.9")).toBe(false);
- });
- });
-
- describe("tilde range (~)", () => {
- it("allows same major.minor, higher patch", () => {
- expect(isApiVersionCompatible("~0.1.0", "0.1.0")).toBe(true);
- expect(isApiVersionCompatible("~0.1.0", "0.1.5")).toBe(true);
- });
-
- it("rejects different minor", () => {
- expect(isApiVersionCompatible("~0.1.0", "0.2.0")).toBe(false);
- });
-
- it("rejects below minimum", () => {
- expect(isApiVersionCompatible("~1.2.3", "1.2.2")).toBe(false);
- });
- });
-
- describe(">= range", () => {
- it("allows equal or higher", () => {
- expect(isApiVersionCompatible(">=0.1.0", "0.1.0")).toBe(true);
- expect(isApiVersionCompatible(">=0.1.0", "0.2.0")).toBe(true);
- expect(isApiVersionCompatible(">=0.1.0", "1.0.0")).toBe(true);
- });
-
- it("rejects below minimum", () => {
- expect(isApiVersionCompatible(">=0.2.0", "0.1.0")).toBe(false);
- expect(isApiVersionCompatible(">=1.0.0", "0.9.9")).toBe(false);
- });
- });
-
- describe("invalid input", () => {
- it("throws on invalid kernel version", () => {
- expect(() => isApiVersionCompatible("^0.1.0", "abc")).toThrow(/invalid semver/i);
- });
-
- it("throws on invalid range version", () => {
- expect(() => isApiVersionCompatible("not-a-range", "0.1.0")).toThrow(/invalid semver/i);
- });
- });
+ describe("wildcard", () => {
+ it("matches any version", () => {
+ expect(isApiVersionCompatible("*", "0.1.0")).toBe(true);
+ expect(isApiVersionCompatible("*", "1.0.0")).toBe(true);
+ expect(isApiVersionCompatible("*", "99.99.99")).toBe(true);
+ });
+ });
+
+ describe("exact match", () => {
+ it("matches identical version", () => {
+ expect(isApiVersionCompatible("0.1.0", "0.1.0")).toBe(true);
+ });
+
+ it("rejects different patch", () => {
+ expect(isApiVersionCompatible("0.1.0", "0.1.1")).toBe(false);
+ });
+
+ it("rejects different minor", () => {
+ expect(isApiVersionCompatible("0.1.0", "0.2.0")).toBe(false);
+ });
+
+ it("rejects different major", () => {
+ expect(isApiVersionCompatible("1.0.0", "2.0.0")).toBe(false);
+ });
+ });
+
+ describe("caret range (^)", () => {
+ it("0.x: allows same minor, higher patch", () => {
+ expect(isApiVersionCompatible("^0.1.0", "0.1.0")).toBe(true);
+ expect(isApiVersionCompatible("^0.1.0", "0.1.5")).toBe(true);
+ expect(isApiVersionCompatible("^0.1.0", "0.1.99")).toBe(true);
+ });
+
+ it("0.x: rejects different minor", () => {
+ expect(isApiVersionCompatible("^0.1.0", "0.2.0")).toBe(false);
+ expect(isApiVersionCompatible("^0.1.0", "0.0.9")).toBe(false);
+ });
+
+ it("0.x: rejects different major", () => {
+ expect(isApiVersionCompatible("^0.1.0", "1.0.0")).toBe(false);
+ });
+
+ it("1.x+: allows same major, higher minor/patch", () => {
+ expect(isApiVersionCompatible("^1.2.0", "1.2.0")).toBe(true);
+ expect(isApiVersionCompatible("^1.2.0", "1.3.0")).toBe(true);
+ expect(isApiVersionCompatible("^1.2.0", "1.99.0")).toBe(true);
+ });
+
+ it("1.x+: rejects next major", () => {
+ expect(isApiVersionCompatible("^1.2.0", "2.0.0")).toBe(false);
+ });
+
+ it("rejects below minimum", () => {
+ expect(isApiVersionCompatible("^1.2.3", "1.2.2")).toBe(false);
+ expect(isApiVersionCompatible("^1.2.3", "1.1.9")).toBe(false);
+ });
+ });
+
+ describe("tilde range (~)", () => {
+ it("allows same major.minor, higher patch", () => {
+ expect(isApiVersionCompatible("~0.1.0", "0.1.0")).toBe(true);
+ expect(isApiVersionCompatible("~0.1.0", "0.1.5")).toBe(true);
+ });
+
+ it("rejects different minor", () => {
+ expect(isApiVersionCompatible("~0.1.0", "0.2.0")).toBe(false);
+ });
+
+ it("rejects below minimum", () => {
+ expect(isApiVersionCompatible("~1.2.3", "1.2.2")).toBe(false);
+ });
+ });
+
+ describe(">= range", () => {
+ it("allows equal or higher", () => {
+ expect(isApiVersionCompatible(">=0.1.0", "0.1.0")).toBe(true);
+ expect(isApiVersionCompatible(">=0.1.0", "0.2.0")).toBe(true);
+ expect(isApiVersionCompatible(">=0.1.0", "1.0.0")).toBe(true);
+ });
+
+ it("rejects below minimum", () => {
+ expect(isApiVersionCompatible(">=0.2.0", "0.1.0")).toBe(false);
+ expect(isApiVersionCompatible(">=1.0.0", "0.9.9")).toBe(false);
+ });
+ });
+
+ describe("invalid input", () => {
+ it("throws on invalid kernel version", () => {
+ expect(() => isApiVersionCompatible("^0.1.0", "abc")).toThrow(/invalid semver/i);
+ });
+
+ it("throws on invalid range version", () => {
+ expect(() => isApiVersionCompatible("not-a-range", "0.1.0")).toThrow(/invalid semver/i);
+ });
+ });
});