mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
mcp: namespace tests
This commit is contained in:
@@ -83,7 +83,7 @@ pub fn sendError(self: *Self, id: std.json.Value, code: protocol.ErrorCode, mess
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
test "MCP Integration: synchronous smoke test" {
|
test "MCP.Server - Integration: synchronous smoke test" {
|
||||||
const allocator = testing.allocator;
|
const allocator = testing.allocator;
|
||||||
const app = testing.test_app;
|
const app = testing.test_app;
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ pub const JsonEscapingWriter = struct {
|
|||||||
|
|
||||||
const testing = @import("../testing.zig");
|
const testing = @import("../testing.zig");
|
||||||
|
|
||||||
test "protocol request parsing" {
|
test "MCP.protocol - request parsing" {
|
||||||
const raw_json =
|
const raw_json =
|
||||||
\\{
|
\\{
|
||||||
\\ "jsonrpc": "2.0",
|
\\ "jsonrpc": "2.0",
|
||||||
@@ -221,7 +221,7 @@ test "protocol request parsing" {
|
|||||||
try testing.expectString("1.0.0", init_params.value.clientInfo.version);
|
try testing.expectString("1.0.0", init_params.value.clientInfo.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
test "protocol response formatting" {
|
test "MCP.protocol - response formatting" {
|
||||||
const response = Response{
|
const response = Response{
|
||||||
.id = .{ .integer = 42 },
|
.id = .{ .integer = 42 },
|
||||||
.result = .{ .string = "success" },
|
.result = .{ .string = "success" },
|
||||||
@@ -234,7 +234,7 @@ test "protocol response formatting" {
|
|||||||
try testing.expectString("{\"jsonrpc\":\"2.0\",\"id\":42,\"result\":\"success\"}", aw.written());
|
try testing.expectString("{\"jsonrpc\":\"2.0\",\"id\":42,\"result\":\"success\"}", aw.written());
|
||||||
}
|
}
|
||||||
|
|
||||||
test "protocol error formatting" {
|
test "MCP.protocol - error formatting" {
|
||||||
const response = Response{
|
const response = Response{
|
||||||
.id = .{ .string = "abc" },
|
.id = .{ .string = "abc" },
|
||||||
.@"error" = .{
|
.@"error" = .{
|
||||||
@@ -250,7 +250,7 @@ test "protocol error formatting" {
|
|||||||
try testing.expectString("{\"jsonrpc\":\"2.0\",\"id\":\"abc\",\"error\":{\"code\":-32601,\"message\":\"Method not found\"}}", aw.written());
|
try testing.expectString("{\"jsonrpc\":\"2.0\",\"id\":\"abc\",\"error\":{\"code\":-32601,\"message\":\"Method not found\"}}", aw.written());
|
||||||
}
|
}
|
||||||
|
|
||||||
test "JsonEscapingWriter" {
|
test "MCP.protocol - JsonEscapingWriter" {
|
||||||
var aw: std.Io.Writer.Allocating = .init(testing.allocator);
|
var aw: std.Io.Writer.Allocating = .init(testing.allocator);
|
||||||
defer aw.deinit();
|
defer aw.deinit();
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ test "JsonEscapingWriter" {
|
|||||||
try testing.expectString("hello\\n\\\"world\\\"", aw.written());
|
try testing.expectString("hello\\n\\\"world\\\"", aw.written());
|
||||||
}
|
}
|
||||||
|
|
||||||
test "Tool serialization" {
|
test "MCP.protocol - Tool serialization" {
|
||||||
const t = Tool{
|
const t = Tool{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.inputSchema = minify(
|
.inputSchema = minify(
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ fn handleInitialize(server: *Server, req: protocol.Request) !void {
|
|||||||
|
|
||||||
const testing = @import("../testing.zig");
|
const testing = @import("../testing.zig");
|
||||||
|
|
||||||
test "handleMessage - synchronous unit tests" {
|
test "MCP.router - handleMessage - synchronous unit tests" {
|
||||||
const allocator = testing.allocator;
|
const allocator = testing.allocator;
|
||||||
const app = testing.test_app;
|
const app = testing.test_app;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user