|
1 | | -import fs from "node:fs"; |
2 | | -import path from "node:path"; |
3 | 1 | import { describe, expect, it } from "vitest"; |
4 | 2 | import { |
5 | 3 | getOfficialExternalPluginCatalogEntry, |
@@ -48,41 +46,4 @@ describe("official external plugin catalog", () => {
|
48 | 46 | expect(ids.has("matrix")).toBe(false); |
49 | 47 | expect(ids.has("mattermost")).toBe(false); |
50 | 48 | }); |
51 | | - |
52 | | -it("keeps local package install metadata aligned with external catalog specs", () => { |
53 | | -const mismatches: string[] = []; |
54 | | - |
55 | | -for (const entry of listOfficialExternalPluginCatalogEntries()) { |
56 | | -const pluginId = resolveOfficialExternalPluginId(entry); |
57 | | -const catalogInstall = resolveOfficialExternalPluginInstall(entry); |
58 | | -if (!pluginId || !catalogInstall) { |
59 | | -continue; |
60 | | -} |
61 | | -const packagePath = path.join("extensions", pluginId, "package.json"); |
62 | | -if (!fs.existsSync(packagePath)) { |
63 | | -continue; |
64 | | -} |
65 | | -const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8")) as { |
66 | | -openclaw?: { |
67 | | -install?: { |
68 | | -clawhubSpec?: string; |
69 | | -npmSpec?: string; |
70 | | -}; |
71 | | -}; |
72 | | -}; |
73 | | -const packageInstall = packageJson.openclaw?.install ?? {}; |
74 | | -if (packageInstall.npmSpec && packageInstall.npmSpec !== catalogInstall.npmSpec) { |
75 | | -mismatches.push( |
76 | | -`${pluginId} npmSpec catalog=${catalogInstall.npmSpec ?? "<none>"} package=${packageInstall.npmSpec}`, |
77 | | -); |
78 | | -} |
79 | | -if (packageInstall.clawhubSpec && packageInstall.clawhubSpec !== catalogInstall.clawhubSpec) { |
80 | | -mismatches.push( |
81 | | -`${pluginId} clawhubSpec catalog=${catalogInstall.clawhubSpec ?? "<none>"} package=${packageInstall.clawhubSpec}`, |
82 | | -); |
83 | | -} |
84 | | -} |
85 | | - |
86 | | -expect(mismatches).toEqual([]); |
87 | | -}); |
88 | 49 | }); |