Refactor/internal testing (#194)

* added NoError check

* corrected NoError

* has error checks

* replace more checks

* Used checks test helper

* Used checks test helper

* remove duplicate import

* fixed lint issues regarding length of messages

---------

Co-authored-by: Rex Posadas <rposadas@redwoodlogistics.com>
This commit is contained in:
rex posadas
2023-03-25 01:55:25 +08:00
committed by GitHub
parent 479dab3b69
commit 8e3a04664e
15 changed files with 115 additions and 140 deletions

View File

@@ -3,6 +3,7 @@ package openai_test
import (
. "github.com/sashabaranov/go-openai"
"github.com/sashabaranov/go-openai/internal/test"
"github.com/sashabaranov/go-openai/internal/test/checks"
"context"
"encoding/json"
@@ -66,9 +67,7 @@ func TestCompletions(t *testing.T) {
}
req.Prompt = "Lorem ipsum"
_, err = client.CreateCompletion(ctx, req)
if err != nil {
t.Fatalf("CreateCompletion error: %v", err)
}
checks.NoError(t, err, "CreateCompletion error")
}
// handleCompletionEndpoint Handles the completion endpoint by the test server.