
























@@ -11,6 +11,7 @@ const buildPluginDiagnosticsReportMock = vi.hoisted(() => vi.fn());
1111const buildPluginInspectReportMock = vi.hoisted(() => vi.fn());
1212const buildAllPluginInspectReportsMock = vi.hoisted(() => vi.fn());
1313const formatPluginCompatibilityNoticeMock = vi.hoisted(() => vi.fn(() => "ok"));
14+const refreshPluginRegistryAfterConfigMutationMock = vi.hoisted(() => vi.fn(async () => undefined));
14151516vi.mock("../../cli/npm-resolution.js", () => ({
1617buildNpmInstallRecordFields: vi.fn(),
@@ -27,6 +28,10 @@ vi.mock("../../cli/plugins-install-persist.js", () => ({
2728persistPluginInstall: vi.fn(async () => undefined),
2829}));
293031+vi.mock("../../cli/plugins-registry-refresh.js", () => ({
32+refreshPluginRegistryAfterConfigMutation: refreshPluginRegistryAfterConfigMutationMock,
33+}));
34+3035vi.mock("../../config/config.js", () => ({
3136readConfigFileSnapshot: readConfigFileSnapshotMock,
3237validateConfigObjectWithPlugins: validateConfigObjectWithPluginsMock,
@@ -208,6 +213,18 @@ describe("handlePluginsCommand", () => {
208213}),
209214}),
210215);
216+expect(refreshPluginRegistryAfterConfigMutationMock).toHaveBeenLastCalledWith(
217+expect.objectContaining({
218+reason: "policy-changed",
219+config: expect.objectContaining({
220+plugins: expect.objectContaining({
221+entries: expect.objectContaining({
222+superpowers: expect.objectContaining({ enabled: true }),
223+}),
224+}),
225+}),
226+}),
227+);
211228212229const disableParams = buildPluginsParams("/plugins disable superpowers", buildCfg());
213230disableParams.command.senderIsOwner = true;
@@ -223,6 +240,18 @@ describe("handlePluginsCommand", () => {
223240}),
224241}),
225242);
243+expect(refreshPluginRegistryAfterConfigMutationMock).toHaveBeenLastCalledWith(
244+expect.objectContaining({
245+reason: "policy-changed",
246+config: expect.objectContaining({
247+plugins: expect.objectContaining({
248+entries: expect.objectContaining({
249+superpowers: expect.objectContaining({ enabled: false }),
250+}),
251+}),
252+}),
253+}),
254+);
226255});
227256228257it("resolves write targets by runtime-derived plugin name", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。