]> git.giacomolli.uk - onechat/blobdiff - model_fake_helper_test.go
Separate multiline Go statements
[onechat] / model_fake_helper_test.go
index 9873fb6ff0b21529e127113a180557a675f7f685..f9d145121d0512e7efd9b42e5687aa390bdbe261 100644 (file)
@@ -34,6 +34,21 @@ type ModelFake struct {
        reply func(http.ResponseWriter, ModelFakeCall)
 }
 
        reply func(http.ResponseWriter, ModelFakeCall)
 }
 
+func newModelFake(t *testing.T) *ModelFake {
+       t.Helper()
+
+       f := &ModelFake{
+               reply: func(w http.ResponseWriter, _ ModelFakeCall) {
+                       modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("a line")}, 100, 0, 5))
+               },
+       }
+
+       f.Server = httptest.NewServer(http.HandlerFunc(f.serve))
+       t.Cleanup(f.Close)
+
+       return f
+}
+
 // Call returns call number n.
 func (f *ModelFake) Call(n int) ModelFakeCall {
        f.mutex.Lock()
 // Call returns call number n.
 func (f *ModelFake) Call(n int) ModelFakeCall {
        f.mutex.Lock()
@@ -80,21 +95,6 @@ func (f *ModelFake) serve(w http.ResponseWriter, r *http.Request) {
        reply(w, call)
 }
 
        reply(w, call)
 }
 
-func newModelFake(t *testing.T) *ModelFake {
-       t.Helper()
-
-       f := &ModelFake{
-               reply: func(w http.ResponseWriter, _ ModelFakeCall) {
-                       modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem("a line")}, 100, 0, 5))
-               },
-       }
-
-       f.Server = httptest.NewServer(http.HandlerFunc(f.serve))
-       t.Cleanup(f.Close)
-
-       return f
-}
-
 func modelTestRequest() ModelRequest {
        return ModelRequest{
                Model:  "gpt-test",
 func modelTestRequest() ModelRequest {
        return ModelRequest{
                Model:  "gpt-test",
@@ -174,15 +174,6 @@ func modelReadUsage(t *testing.T, path string) []ModelUsageRecord {
        return records
 }
 
        return records
 }
 
-func modelReasoningItem(id, encrypted string) map[string]any {
-       return map[string]any{
-               "type":              "reasoning",
-               "id":                id,
-               "encrypted_content": encrypted,
-               "summary":           []any{},
-       }
-}
-
 func modelFunctionCallItem(id, callID, name, arguments string) map[string]any {
        return map[string]any{
                "type":      "function_call",
 func modelFunctionCallItem(id, callID, name, arguments string) map[string]any {
        return map[string]any{
                "type":      "function_call",