]> git.giacomolli.uk - onechat/blobdiff - compactor_test.go
Describe queued event delivery boundaries
[onechat] / compactor_test.go
index 854051574f6ed6218026a0e415fda5489883ba69..dcd9c3379edc5d984707c26c815f106923ef2349 100644 (file)
@@ -129,16 +129,19 @@ func TestCompactorFailsWithoutALine(t *testing.T) {
                want  string
        }{
                {
                want  string
        }{
                {
-                       name: "failed call",
+                       name: "reports the model call failure",
                        reply: func(w http.ResponseWriter, _ ModelFakeCall) {
                                w.WriteHeader(http.StatusInternalServerError)
 
                        reply: func(w http.ResponseWriter, _ ModelFakeCall) {
                                w.WriteHeader(http.StatusInternalServerError)
 
-                               _, _ = io.WriteString(w, "down")
+                               _, err := io.WriteString(w, "down")
+                               if err != nil {
+                                       panic(err)
+                               }
                        },
                        want: "HTTP 500",
                },
                {
                        },
                        want: "HTTP 500",
                },
                {
-                       name: "tool call and no text",
+                       name: "refuses a response without summary text",
                        reply: func(w http.ResponseWriter, _ ModelFakeCall) {
                                modelWriteEvents(w, modelCompletedEvent([]any{map[string]any{"type": "function_call", "name": "zoom", "arguments": "{}"}}, 100, 0, 5))
                        },
                        reply: func(w http.ResponseWriter, _ ModelFakeCall) {
                                modelWriteEvents(w, modelCompletedEvent([]any{map[string]any{"type": "function_call", "name": "zoom", "arguments": "{}"}}, 100, 0, 5))
                        },
@@ -208,7 +211,7 @@ func newTestCompactor(t *testing.T, server *ModelFake) *Compactor {
        return newCompactor(client, compactorAdaPrompt, ModelConfig{
                Model:  "gpt-test",
                Effort: "high",
        return newCompactor(client, compactorAdaPrompt, ModelConfig{
                Model:  "gpt-test",
                Effort: "high",
-       }, promptTools())
+       }, promptTools(), &ImageStore{dir: t.TempDir()})
 }
 
 // compactorInputTexts returns the text of each user message of call. Each
 }
 
 // compactorInputTexts returns the text of each user message of call. Each