TestSendPropagatesProviderError makes sure a provider failure bubbles out of Send instead of being swallowed. The error itself should be the exact sentinel — no wrapping at this layer.
(t *testing.T)
| 140 | // out of Send instead of being swallowed. The error itself should be the |
| 141 | // exact sentinel — no wrapping at this layer. |
| 142 | func TestSendPropagatesProviderError(t *testing.T) { |
| 143 | sentinel := errors.New("provider exploded") |
| 144 | p := &provider.MockProvider{Err: sentinel} |
| 145 | a := newTestAgent(p) |
| 146 | |
| 147 | _, err := a.Send(context.Background(), "hi") |
| 148 | if !errors.Is(err, sentinel) { |
| 149 | t.Errorf("err = %v, want %v", err, sentinel) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | // hasToolResult scans messages for a tool_result block matching id. |
| 154 | func hasToolResult(messages []api.Message, id string) bool { |
nothing calls this directly
no test coverage detected