X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/a3b9849a54a6cd8a4cc5b1ae03a39aab31322f7b..522d7fd117285e4e4ce3ea5ec9b5a1722521b681:/compactor_test.go?ds=sidebyside diff --git a/compactor_test.go b/compactor_test.go index f4c51f4..8c83594 100644 --- a/compactor_test.go +++ b/compactor_test.go @@ -167,6 +167,7 @@ func TestCompactorRetriesALongLineWithTheNewestNote(t *testing.T) { records := modelReadUsage(t, compactor.client.usage.path) require.Len(t, records, 3) + for n, record := range records { require.Equal(t, &[2]int{0, 0}, record.Node) require.Equal(t, len(long[n]), record.TextBytes) @@ -174,6 +175,7 @@ func TestCompactorRetriesALongLineWithTheNewestNote(t *testing.T) { first := compactorInputTexts(t, server.Call(0)) require.Len(t, first, 2) + for n, want := range []string{long[0], long[1]} { call := server.Call(n + 1) texts := compactorInputTexts(t, call) @@ -211,6 +213,7 @@ func TestCompactorFailsWithoutALine(t *testing.T) { name: "failed call", reply: func(w http.ResponseWriter, _ ModelFakeCall) { w.WriteHeader(http.StatusInternalServerError) + _, _ = io.WriteString(w, "down") }, want: "HTTP 500", @@ -249,6 +252,7 @@ func TestCompactorBuildsNodesInTheCore(t *testing.T) { server.reply = func(w http.ResponseWriter, call ModelFakeCall) { if call.number == 0 { w.WriteHeader(http.StatusServiceUnavailable) + return } @@ -310,6 +314,7 @@ func compactorInputTexts(t *testing.T, call ModelFakeCall) []string { require.Equal(t, "user", message.Role) require.Len(t, message.Content, 1) require.Equal(t, "input_text", message.Content[0].Type) + texts[n] = message.Content[0].Text }