add WIP 0.3
This commit is contained in:
parent
143aa9a63c
commit
f7efd3a444
1 changed files with 143 additions and 10 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
import { McpbManifestSchema } from "../src/schemas/index.js";
|
||||
import { McpbManifestSchema, v0_3 } from "../src/schemas/index.js";
|
||||
|
||||
describe("McpbManifestSchema", () => {
|
||||
it("should validate a valid manifest", () => {
|
||||
|
|
@ -137,9 +137,9 @@ describe("McpbManifestSchema", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip("_meta", () => {
|
||||
describe("_meta", () => {
|
||||
const base = {
|
||||
manifest_version: "0.2",
|
||||
manifest_version: "0.3",
|
||||
name: "client-ext-test",
|
||||
version: "1.0.0",
|
||||
description: "Test manifest",
|
||||
|
|
@ -155,11 +155,14 @@ describe("McpbManifestSchema", () => {
|
|||
const manifest = {
|
||||
...base,
|
||||
_meta: {
|
||||
"com.microsoft.windows": { package_family_name: "Pkg_123", channel: "stable" },
|
||||
"com.microsoft.windows": {
|
||||
package_family_name: "Pkg_123",
|
||||
channel: "stable",
|
||||
},
|
||||
"com.apple.darwin": { bundle_id: "com.example.app", notarized: true },
|
||||
},
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
|
|
@ -167,10 +170,13 @@ describe("McpbManifestSchema", () => {
|
|||
const manifest = {
|
||||
...base,
|
||||
_meta: {
|
||||
"com.microsoft.windows": "raw-string" as unknown as Record<string, unknown>,
|
||||
"com.microsoft.windows": "raw-string" as unknown as Record<
|
||||
string,
|
||||
unknown
|
||||
>,
|
||||
},
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(false);
|
||||
if (!result.success) {
|
||||
const messages = result.error.issues.map((i) => i.message).join("\n");
|
||||
|
|
@ -185,7 +191,7 @@ describe("McpbManifestSchema", () => {
|
|||
"com.apple.darwin": [] as unknown as Record<string, unknown>,
|
||||
},
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
|
|
@ -196,13 +202,13 @@ describe("McpbManifestSchema", () => {
|
|||
custom: null as unknown as Record<string, unknown>,
|
||||
},
|
||||
};
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(false);
|
||||
});
|
||||
|
||||
it("allows empty object for _meta", () => {
|
||||
const manifest = { ...base, _meta: {} };
|
||||
const result = McpbManifestSchema.safeParse(manifest);
|
||||
const result = v0_3.McpbManifestSchema.safeParse(manifest);
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue