






















@@ -7,6 +7,8 @@ import { withTempDir } from "../test-helpers/temp-dir.js";
77import {
88downloadClawHubPackageArchive,
99downloadClawHubSkillArchive,
10+fetchClawHubPackageArtifact,
11+fetchClawHubPackageReadiness,
1012normalizeClawHubSha256Integrity,
1113normalizeClawHubSha256Hex,
1214parseClawHubPluginSpec,
@@ -222,6 +224,74 @@ describe("clawhub helpers", () => {
222224223225await expect(searchClawHubSkills({ query: "calendar", fetchImpl })).resolves.toEqual([]);
224226});
227+228+it("fetches typed package readiness reports", async () => {
229+let requestedUrl = "";
230+await expect(
231+fetchClawHubPackageReadiness({
232+name: "@openclaw/diagnostics-otel",
233+fetchImpl: async (input) => {
234+requestedUrl = input instanceof Request ? input.url : String(input);
235+return new Response(
236+JSON.stringify({
237+package: { name: "@openclaw/diagnostics-otel", isOfficial: true },
238+phase: "legacy-zip-only",
239+blockers: [],
240+}),
241+{ status: 200, headers: { "content-type": "application/json" } },
242+);
243+},
244+}),
245+).resolves.toEqual({
246+package: { name: "@openclaw/diagnostics-otel", isOfficial: true },
247+phase: "legacy-zip-only",
248+blockers: [],
249+});
250+expect(new URL(requestedUrl).pathname).toBe(
251+"/api/v1/packages/%40openclaw%2Fdiagnostics-otel/readiness",
252+);
253+});
254+255+it("fetches typed package artifact resolver reports", async () => {
256+let requestedUrl = "";
257+await expect(
258+fetchClawHubPackageArtifact({
259+name: "@openclaw/diagnostics-otel",
260+version: "2026.3.22",
261+fetchImpl: async (input) => {
262+requestedUrl = input instanceof Request ? input.url : String(input);
263+return new Response(
264+JSON.stringify({
265+artifact: {
266+source: "clawhub",
267+artifactKind: "npm-pack",
268+packageName: "@openclaw/diagnostics-otel",
269+version: "2026.3.22",
270+downloadUrl: "https://clawhub.ai/api/v1/clawpacks/abc",
271+npmIntegrity: "sha512-demo",
272+npmShasum: "abc",
273+},
274+}),
275+{ status: 200, headers: { "content-type": "application/json" } },
276+);
277+},
278+}),
279+).resolves.toEqual({
280+artifact: {
281+source: "clawhub",
282+artifactKind: "npm-pack",
283+packageName: "@openclaw/diagnostics-otel",
284+version: "2026.3.22",
285+downloadUrl: "https://clawhub.ai/api/v1/clawpacks/abc",
286+npmIntegrity: "sha512-demo",
287+npmShasum: "abc",
288+},
289+});
290+expect(new URL(requestedUrl).pathname).toBe(
291+"/api/v1/packages/%40openclaw%2Fdiagnostics-otel/versions/2026.3.22/artifact",
292+);
293+});
294+225295it("downloads package archives to sanitized temp paths and cleans them up", async () => {
226296const archive = await downloadClawHubPackageArchive({
227297name: "@hyf/zai-external-alpha",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。