From 6f3e36fa4b670e8207d1516f83ad49496a4d0f30 Mon Sep 17 00:00:00 2001 From: Vernon Stinebaker Date: Thu, 7 May 2026 11:40:39 +0800 Subject: [PATCH] test(integration): cover wizard failure contracts --- src/integration_tests.zig | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/integration_tests.zig b/src/integration_tests.zig index 6f57b15..f548067 100644 --- a/src/integration_tests.zig +++ b/src/integration_tests.zig @@ -317,3 +317,52 @@ test "integration harness covers orchestration proxy not configured" { try std.testing.expectEqual(std.http.Status.service_unavailable, resp.status); try std.testing.expect(std.mem.indexOf(u8, resp.body, "NullBoiler not configured") != null); } + +test "integration harness covers wizard failure contracts" { + var server = try IntegrationServer.start(std.testing.allocator); + defer server.deinit(); + + { + const resp = try server.fetch(.{ + .path = "/api/wizard/nullclaw", + .method = .POST, + .body = "{", + }); + defer resp.deinit(std.testing.allocator); + try std.testing.expectEqual(std.http.Status.bad_request, resp.status); + try std.testing.expect(std.mem.indexOf(u8, resp.body, "invalid JSON body") != null); + } + + { + const resp = try server.fetch(.{ + .path = "/api/wizard/missing-component", + .method = .POST, + .body = "{\"instance_name\":\"demo\"}", + }); + defer resp.deinit(std.testing.allocator); + try std.testing.expectEqual(std.http.Status.not_found, resp.status); + try std.testing.expect(std.mem.indexOf(u8, resp.body, "component not found") != null); + } + + { + const resp = try server.fetch(.{ + .path = "/api/wizard/nullclaw/validate-providers", + .method = .POST, + .body = "{", + }); + defer resp.deinit(std.testing.allocator); + try std.testing.expectEqual(std.http.Status.bad_request, resp.status); + try std.testing.expect(std.mem.indexOf(u8, resp.body, "invalid JSON body") != null); + } + + { + const resp = try server.fetch(.{ + .path = "/api/wizard/missing-component/validate-providers", + .method = .POST, + .body = "{\"providers\":[]}", + }); + defer resp.deinit(std.testing.allocator); + try std.testing.expectEqual(std.http.Status.not_found, resp.status); + try std.testing.expect(std.mem.indexOf(u8, resp.body, "component not found") != null); + } +}