c53f699714
- go plugin backends ship as release tarballs (per-platform binaries, checksums) that kandev installs from url/upload or filesystem sideload+sync, then spawns and supervises via hashicorp/go-plugin (unix socket / loopback tcp+automtls) - strict typed grpc contract (kandev.plugin.v1): DeliverEvent/InvokeTool/HandleWebhook plus a capability-gated host service (state, secrets, emit); author sdk in pkg/pluginsdk; packaging cli in cmd/plugin-pack - native frontend bundles: window.registerKandevPlugin + registry/host loader with dynamic routes, nav items, slots and ws handlers; plugins settings page with install dialog, sync button and enable/disable/uninstall - gated behind the plugins feature flag (prod off, dev/e2e on); covered by unit and integration tests plus playwright e2e against a real packaged fixture plugin Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { summarizeSyncResult } from "./sync-summary";
|
|
import type { SyncResult } from "@/lib/types/plugins";
|
|
|
|
function result(overrides: Partial<SyncResult> = {}): SyncResult {
|
|
return { added: [], installed: [], missing: [], errors: [], ...overrides };
|
|
}
|
|
|
|
describe("summarizeSyncResult", () => {
|
|
it("returns 'Everything up to date' when nothing changed", () => {
|
|
expect(summarizeSyncResult(result())).toBe("Everything up to date");
|
|
});
|
|
|
|
it("summarizes a single category", () => {
|
|
expect(summarizeSyncResult(result({ added: ["a"] }))).toBe("Sync: 1 sideloaded");
|
|
});
|
|
|
|
it("summarizes multiple categories in added/installed/missing order", () => {
|
|
expect(
|
|
summarizeSyncResult(result({ added: ["a", "b"], installed: ["c"], missing: ["d"] })),
|
|
).toBe("Sync: 2 sideloaded, 1 installed, 1 missing");
|
|
});
|
|
|
|
it("ignores errors alone when nothing else changed", () => {
|
|
expect(summarizeSyncResult(result({ errors: [{ path: "/x.tar.gz", reason: "bad" }] }))).toBe(
|
|
"Everything up to date",
|
|
);
|
|
});
|
|
|
|
it("counts installed and missing without added", () => {
|
|
expect(summarizeSyncResult(result({ installed: ["a"], missing: ["b", "c"] }))).toBe(
|
|
"Sync: 1 installed, 2 missing",
|
|
);
|
|
});
|
|
});
|