Add tests (#171)
* test models listing * remove non-needed method * test for .streamFinished * add more error tests * improve stream testing * fix typo
This commit is contained in:
@@ -141,6 +141,9 @@ func TestAPIError(t *testing.T) {
|
||||
if *apiErr.Code != "invalid_api_key" {
|
||||
t.Fatalf("Unexpected API error code: %s", *apiErr.Code)
|
||||
}
|
||||
if apiErr.Error() == "" {
|
||||
t.Fatal("Empty error message occured")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestError(t *testing.T) {
|
||||
@@ -163,6 +166,10 @@ func TestRequestError(t *testing.T) {
|
||||
if reqErr.StatusCode != 418 {
|
||||
t.Fatalf("Unexpected request error status code: %d", reqErr.StatusCode)
|
||||
}
|
||||
|
||||
if reqErr.Unwrap() == nil {
|
||||
t.Fatalf("Empty request error occured")
|
||||
}
|
||||
}
|
||||
|
||||
// numTokens Returns the number of GPT-3 encoded tokens in the given text.
|
||||
|
||||
Reference in New Issue
Block a user