- Rename all user-facing and technical identifiers from OpenPets/Pet to FamiliarOS/Familiar. - Rename packages from @open-pets/* to @familiaros/*; rename install-pet/pet-format packages. - Rename plugin IDs and directories from openpets.* to familiaros.*. - Rename IPC namespace from openpets:* to familiaros:* and state filenames from openpets-* to familiaros-* with legacy migration. - Rename source files (pet-window, built-in-pet, default-pet-controller, etc.) to familiar equivalents. - Update locales (en, es-419, ja, ko, pt-BR, zh-Hans, zh-Hant) and tray/pet context menu strings. - Add Familiar naming feature: preference, settings input, tray menu display. - Update assets and packaging config; all desktop tests pass.
22 lines
2.1 KiB
TypeScript
22 lines
2.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { validatePluginCatalog } from "../src/plugin-catalog-validation.js";
|
|
|
|
const entry = { id: "hello-plugin", name: "Hello", version: "1.0.0", description: "desc", runtime: "declarative", permissions: ["timer", "familiar:speak"], downloadUrl: "https://zip.familiaros.dev/plugins/hello.zip", sha256: "a".repeat(64) };
|
|
|
|
const catalog = validatePluginCatalog({ version: 1, generatedAt: new Date().toISOString(), plugins: [entry] });
|
|
assert.equal(catalog.plugins[0].id, "hello-plugin");
|
|
assert.deepEqual(catalog.plugins[0].permissions, ["familiar:speak", "timer"]);
|
|
|
|
assert.throws(() => validatePluginCatalog({ version: 1, generatedAt: "now", plugins: [{ ...entry, extra: true }] }), /Unknown field/);
|
|
assert.throws(() => validatePluginCatalog({ version: 1, generatedAt: "now", plugins: [entry, entry] }), /Duplicate plugin id/);
|
|
assert.throws(() => validatePluginCatalog({ version: 1, generatedAt: "now", plugins: [{ ...entry, sha256: "A".repeat(64) }] }), /sha256/);
|
|
|
|
const catalogV2 = validatePluginCatalog({ version: 2, generatedAt: "now", plugins: [{ ...entry, id: "js-plugin", runtime: "javascript", icon: "github", sdkVersion: "1.0.0", permissions: ["familiar:speak", "network"], minFamiliarOSVersion: "2.0.0", maxFamiliarOSVersion: "3.0.0", deprecated: true, statusReason: "Use another plugin", network: { hosts: ["api.example.com"] } }] });
|
|
assert.equal(catalogV2.version, 2);
|
|
assert.equal(catalogV2.plugins[0].runtime, "javascript");
|
|
assert.equal(catalogV2.plugins[0].icon, "github");
|
|
assert.throws(() => validatePluginCatalog({ version: 2, generatedAt: "now", plugins: [{ ...entry, runtime: "python" }] }), /runtime/);
|
|
assert.throws(() => validatePluginCatalog({ version: 2, generatedAt: "now", plugins: [{ ...entry, icon: "https://example.com/icon.svg" }] }), /icon/);
|
|
assert.throws(() => validatePluginCatalog({ version: 2, generatedAt: "now", plugins: [{ ...entry, runtime: "javascript", sdkVersion: "1.0.0", permissions: ["familiar:speak", "network"], network: { hosts: ["*.example.com"] } }] }), /network/);
|
|
|
|
console.error("Plugin catalog validation passed.");
|