package cli import ( "encoding/json" "testing" ) func TestPreflightDoesNotAuthorizeInstallation(t *testing.T) { code, out, diagnostics := run([]string{"preflight"}, "") var response struct { ProtocolVersion int `json:"protocolVersion"` Mode string `json:"mode"` Proposal struct { Executable bool `json:"executable"` Blockers []string `json:"blockers"` } `json:"proposal"` } if code != 0 || json.Unmarshal([]byte(out), &response) != nil || response.ProtocolVersion != 1 || response.Mode != "local-environment-proposal" || response.Proposal.Executable || len(response.Proposal.Blockers) == 0 { t.Fatalf("unsafe report: %s %s", out, diagnostics) } }