diff --git a/src/infra/update-startup.test.ts b/src/infra/update-startup.test.ts index 64dcc25f95b..49732e12ce7 100644 --- a/src/infra/update-startup.test.ts +++ b/src/infra/update-startup.test.ts @@ -9,11 +9,23 @@ vi.mock("./openclaw-root.js", () => ({ })); vi.mock("./update-check.js", async () => { - const actual = await vi.importActual("./update-check.js"); + const parse = (value: string) => value.split(".").map((part) => Number.parseInt(part, 10)); + const compareSemverStrings = (a: string, b: string) => { + const left = parse(a); + const right = parse(b); + for (let idx = 0; idx < 3; idx += 1) { + const l = left[idx] ?? 0; + const r = right[idx] ?? 0; + if (l !== r) { + return l < r ? -1 : 1; + } + } + return 0; + }; + return { - ...actual, checkUpdateStatus: vi.fn(), - fetchNpmTagVersion: vi.fn(), + compareSemverStrings, resolveNpmChannelTag: vi.fn(), }; });