mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
initialized mcp support
This commit is contained in:
36
app/src/modules/mcp/utils.spec.ts
Normal file
36
app/src/modules/mcp/utils.spec.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import { excludePropertyTypes, rescursiveClean } from "./utils";
|
||||
import { s } from "../../core/utils/schema";
|
||||
|
||||
describe("rescursiveOptional", () => {
|
||||
it("should make all properties optional", () => {
|
||||
const schema = s.strictObject({
|
||||
a: s.string(),
|
||||
b: s.number(),
|
||||
nested: s.strictObject({
|
||||
c: s.string().optional(),
|
||||
d: s.number(),
|
||||
nested2: s.record(s.string()),
|
||||
}),
|
||||
});
|
||||
|
||||
//console.log(schema.toJSON());
|
||||
console.log(
|
||||
rescursiveClean(schema, {
|
||||
removeRequired: true,
|
||||
removeDefault: true,
|
||||
}).toJSON(),
|
||||
);
|
||||
/* const result = rescursiveOptional(schema);
|
||||
expect(result.properties.a.optional).toBe(true); */
|
||||
});
|
||||
|
||||
it("should exclude properties", () => {
|
||||
const schema = s.strictObject({
|
||||
a: s.string(),
|
||||
b: s.number(),
|
||||
});
|
||||
|
||||
console.log(excludePropertyTypes(schema, [s.StringSchema]));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user