X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/a5c83e92d7feea2e104b5515043a76c8c4c56c60..80e348724041a694002fc38f57e8868b9b9a2be9:/model_fake_helper_test.go diff --git a/model_fake_helper_test.go b/model_fake_helper_test.go index 00fa808..f9d1451 100644 --- a/model_fake_helper_test.go +++ b/model_fake_helper_test.go @@ -34,6 +34,21 @@ type ModelFake struct { 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() @@ -80,21 +95,6 @@ func (f *ModelFake) serve(w http.ResponseWriter, r *http.Request) { 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",