mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:30:42 +00:00
test: tolerate prerelease channel metadata
This commit is contained in:
@@ -8,8 +8,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { TEST_BUNDLED_RUNTIME_SIDECAR_PATHS } from "../../test/helpers/bundled-runtime-sidecars.js";
|
||||
import type { OpenClawConfig, ConfigFileSnapshot } from "../config/types.openclaw.js";
|
||||
import { writePackageDistInventory } from "../infra/package-dist-inventory.js";
|
||||
import { isBetaTag } from "../infra/update-channels.js";
|
||||
import type { UpdateRunResult } from "../infra/update-runner.js";
|
||||
import { withEnvAsync } from "../test-utils/env.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { createCliRuntimeCapture } from "./test-runtime-capture.js";
|
||||
import { isOwningNpmCommand } from "./update-cli.test-helpers.js";
|
||||
|
||||
@@ -1127,7 +1129,7 @@ describe("update-cli", () => {
|
||||
expect(last).toBeDefined();
|
||||
const parsed = last as Record<string, unknown>;
|
||||
const channel = parsed.channel as { value?: unknown };
|
||||
expect(channel.value).toBe("stable");
|
||||
expect(channel.value).toBe(isBetaTag(VERSION) ? "beta" : "stable");
|
||||
},
|
||||
},
|
||||
] as const)("updateStatusCommand rendering: $name", runUpdateCliScenario);
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
baseStatusExpectedUpdateChannelInfo,
|
||||
baseStatusExpectedUpdateChannelLabel,
|
||||
} from "../status.test-support.ts";
|
||||
import {
|
||||
buildStatusGatewaySurfaceValues,
|
||||
buildStatusOverviewRows,
|
||||
@@ -78,12 +82,8 @@ describe("status-all format", () => {
|
||||
} as never,
|
||||
}),
|
||||
).toEqual({
|
||||
channelInfo: {
|
||||
channel: "stable",
|
||||
source: "config",
|
||||
label: "stable (config)",
|
||||
},
|
||||
channelLabel: "stable (config)",
|
||||
channelInfo: baseStatusExpectedUpdateChannelInfo,
|
||||
channelLabel: baseStatusExpectedUpdateChannelLabel,
|
||||
gitLabel: "main · tag v1.2.3",
|
||||
updateLine: `git main · ↔ origin/main · behind 2 · npm update ${newerRegistryVersion}`,
|
||||
updateAvailable: true,
|
||||
@@ -374,7 +374,7 @@ describe("status-all format", () => {
|
||||
{ Item: "Version", Value: "1.0.0" },
|
||||
{ Item: "Dashboard", Value: "http://127.0.0.1:18789/" },
|
||||
{ Item: "Tailscale exposure", Value: "serve · box.tail.ts.net · https://box.tail.ts.net" },
|
||||
{ Item: "Channel", Value: "stable (config)" },
|
||||
{ Item: "Channel", Value: baseStatusExpectedUpdateChannelLabel },
|
||||
{ Item: "Git", Value: "main · tag v1.2.3" },
|
||||
{ Item: "Update", Value: "available · custom update" },
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from "./status-overview-surface.ts";
|
||||
import {
|
||||
baseStatusCfg,
|
||||
baseStatusExpectedUpdateChannelLabel,
|
||||
baseStatusGatewaySnapshot,
|
||||
baseStatusOverviewScanFields,
|
||||
baseStatusOverviewSurface,
|
||||
@@ -82,7 +83,7 @@ describe("status-overview-surface", () => {
|
||||
{ Item: "OS", Value: "macOS · node 22" },
|
||||
{ Item: "Dashboard", Value: "http://127.0.0.1:18789/" },
|
||||
{ Item: "Tailscale exposure", Value: "muted(off · box.tail.ts.net)" },
|
||||
{ Item: "Channel", Value: "stable (config)" },
|
||||
{ Item: "Channel", Value: baseStatusExpectedUpdateChannelLabel },
|
||||
{ Item: "Git", Value: "main · tag v1.2.3" },
|
||||
{ Item: "Update", Value: "available · custom update" },
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { HeartbeatEventPayload } from "../infra/heartbeat-events.js";
|
||||
import { isBetaTag } from "../infra/update-channels.js";
|
||||
import type { Tone } from "../memory-host-sdk/status.js";
|
||||
import type { PluginCompatibilityNotice } from "../plugins/status.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import type { buildStatusCommandOverviewRows } from "./status-overview-rows.ts";
|
||||
import type { StatusOverviewSurface } from "./status-overview-surface.ts";
|
||||
import type { AgentLocalStatus } from "./status.agent-local.js";
|
||||
@@ -30,6 +32,20 @@ export const baseStatusUpdate = {
|
||||
registry: { latestVersion: "2026.4.10" },
|
||||
} as never;
|
||||
|
||||
export const baseStatusExpectedUpdateChannelInfo = isBetaTag(VERSION)
|
||||
? {
|
||||
channel: "beta",
|
||||
source: "installed-version",
|
||||
label: "beta (installed version)",
|
||||
}
|
||||
: {
|
||||
channel: "stable",
|
||||
source: "config",
|
||||
label: "stable (config)",
|
||||
};
|
||||
|
||||
export const baseStatusExpectedUpdateChannelLabel = baseStatusExpectedUpdateChannelInfo.label;
|
||||
|
||||
export const baseStatusGatewaySnapshot = {
|
||||
gatewayMode: "remote",
|
||||
remoteUrlMissing: false,
|
||||
|
||||
@@ -308,12 +308,12 @@ describe("loadPluginManifestRegistry", () => {
|
||||
const stateDir = makeTempDir();
|
||||
const pluginDir = path.join(stateDir, "extensions", "cached-manifest");
|
||||
mkdirSafe(pluginDir);
|
||||
fs.writeFileSync(path.join(pluginDir, "index.ts"), "export default function () {}", "utf-8");
|
||||
fs.writeFileSync(path.join(pluginDir, "index.js"), "export default function () {}", "utf-8");
|
||||
fs.writeFileSync(
|
||||
path.join(pluginDir, "package.json"),
|
||||
JSON.stringify({
|
||||
name: "@openclaw/cached-manifest",
|
||||
openclaw: { extensions: ["./index.ts"] },
|
||||
openclaw: { extensions: ["./index.js"] },
|
||||
}),
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user