test: align release plugin fixtures

This commit is contained in:
Peter Steinberger
2026-05-02 09:19:24 +01:00
parent 331e065407
commit 5e63e813b7
2 changed files with 39 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({
loadPluginManifestRegistryForPluginRegistry: vi.fn(),
loadPluginMetadataSnapshot: vi.fn(),
loadPluginRegistrySnapshotWithMetadata: vi.fn(),
resolveBundledExplicitWebSearchProvidersFromPublicArtifacts: vi.fn(() => null),
resolveBundledExplicitWebFetchProvidersFromPublicArtifacts: vi.fn(() => null),
loadBundledWebSearchProviderEntriesFromDir: vi.fn(),
@@ -10,6 +12,11 @@ const mocks = vi.hoisted(() => ({
vi.mock("./plugin-registry.js", () => ({
loadPluginManifestRegistryForPluginRegistry: mocks.loadPluginManifestRegistryForPluginRegistry,
loadPluginRegistrySnapshotWithMetadata: mocks.loadPluginRegistrySnapshotWithMetadata,
}));
vi.mock("./plugin-metadata-snapshot.js", () => ({
loadPluginMetadataSnapshot: mocks.loadPluginMetadataSnapshot,
}));
vi.mock("./web-search-providers.shared.js", () => ({
@@ -58,6 +65,28 @@ describe("web provider public artifact manifest fallback", () => {
},
],
});
mocks.loadPluginMetadataSnapshot.mockReturnValue({
diagnostics: [],
plugins: [
{
id: "fallback-search",
origin: "bundled",
rootDir: "/tmp/fallback-search",
contracts: { webSearchProviders: ["fallback-search"] },
},
{
id: "fallback-fetch",
origin: "bundled",
rootDir: "/tmp/fallback-fetch",
contracts: { webFetchProviders: ["fallback-fetch"] },
},
],
});
mocks.loadPluginRegistrySnapshotWithMetadata.mockReturnValue({
source: "derived",
snapshot: { plugins: [] },
diagnostics: [],
});
mocks.loadBundledWebSearchProviderEntriesFromDir.mockReturnValue([
{ id: "fallback-search", pluginId: "fallback-search" },
]);
@@ -70,7 +99,8 @@ describe("web provider public artifact manifest fallback", () => {
const providers = resolveBundledWebSearchProvidersFromPublicArtifacts({ config: {} });
expect(providers).toEqual([{ id: "fallback-search", pluginId: "fallback-search" }]);
expect(mocks.loadPluginManifestRegistryForPluginRegistry).toHaveBeenCalledOnce();
expect(mocks.loadPluginMetadataSnapshot).toHaveBeenCalledOnce();
expect(mocks.loadPluginManifestRegistryForPluginRegistry).not.toHaveBeenCalled();
expect(mocks.loadBundledWebSearchProviderEntriesFromDir).toHaveBeenCalledWith({
dirName: "fallback-search",
pluginId: "fallback-search",
@@ -81,7 +111,8 @@ describe("web provider public artifact manifest fallback", () => {
const providers = resolveBundledWebFetchProvidersFromPublicArtifacts({ config: {} });
expect(providers).toEqual([{ id: "fallback-fetch", pluginId: "fallback-fetch" }]);
expect(mocks.loadPluginManifestRegistryForPluginRegistry).toHaveBeenCalledOnce();
expect(mocks.loadPluginMetadataSnapshot).toHaveBeenCalledOnce();
expect(mocks.loadPluginManifestRegistryForPluginRegistry).not.toHaveBeenCalled();
expect(mocks.loadBundledWebFetchProviderEntriesFromDir).toHaveBeenCalledWith({
dirName: "fallback-fetch",
pluginId: "fallback-fetch",

View File

@@ -154,6 +154,9 @@ describe("collectClawHubVersionGateErrors", () => {
compat: {
pluginApi: ">=2026.4.1",
},
install: {
npmSpec: "@openclaw/demo-plugin",
},
build: {
openclawVersion: "2026.4.1",
},
@@ -360,6 +363,9 @@ function createTempPluginRepo(
openclawVersion: "2026.4.1",
},
}),
install: {
npmSpec: `@openclaw/${currentExtensionId}`,
},
release: {
publishToClawHub: options.publishToClawHub ?? true,
},