package client import ( "encoding/json" "testing" "crypto-miner-agent/miner" ) func TestApplyContingencyPolicyEnablesRunner(t *testing.T) { c := &AgentClient{} raw, _ := json.Marshal(miner.ContingencyPolicy{ Enabled: true, Personas: []string{"silent", "aggressive"}, }) c.applyContingencyPolicyJSON(raw) if c.contingency == nil || !c.contingency.enabled { t.Fatal("expected contingency enabled") } if c.contingency.runner == nil { t.Fatal("expected runner built") } } func TestApplyContingencyBranchParams(t *testing.T) { c := &AgentClient{} raw, _ := json.Marshal(miner.ContingencyPolicy{Enabled: true}) c.applyContingencyPolicyJSON(raw) params, _ := json.Marshal(miner.ContingencyBranchParams{ BranchOrder: []string{"container", "inprocess"}, Persona: "aggressive", SkipMethods: []string{"gpu_subprocess"}, Reason: "court branch splice", }) c.applyContingencyBranchParamsJSON(params) if c.contingency == nil || c.contingency.runner == nil { t.Fatal("expected runner after branch params") } } func TestContingencyDepthForStats(t *testing.T) { c := &AgentClient{} if c.contingencyDepthForStats() != 0 { t.Fatal("expected 0 depth") } }