mirror of
https://github.com/langgenius/dify.git
synced 2026-08-24 22:11:36 -04:00
4ee43b8afc
Import the committed KnowledgeFS snapshot dc4072ee302317145612087ce7440851dc329fd0 under knowledge-fs/ without its Git history, local IDE settings, or build artifacts.
24 lines
750 B
TypeScript
24 lines
750 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { asLooseOpenApiContext, openApiHandler } from "./openapi-handler-utils";
|
|
|
|
describe("OpenAPI handler utilities", () => {
|
|
it("casts OpenAPI contexts without changing the runtime object", () => {
|
|
const context = {
|
|
get: (name: "subject" | "traceId") => name,
|
|
json: (body: unknown, status?: number) => new Response(JSON.stringify({ body, status })),
|
|
req: {
|
|
valid: (target: "json" | "param" | "query") => ({ target }),
|
|
},
|
|
};
|
|
|
|
expect(asLooseOpenApiContext(context)).toBe(context);
|
|
});
|
|
|
|
it("casts handlers without wrapping them", () => {
|
|
const handler = async () => new Response("ok");
|
|
|
|
expect(openApiHandler(handler)).toBe(handler);
|
|
});
|
|
});
|