-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into meili-bot/bump-version
- Loading branch information
Showing
7 changed files
with
329 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package meilisearch | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestError_VersionErrorHintMessage(t *testing.T) { | ||
type args struct { | ||
request *internalRequest | ||
mockedError error | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
}{ | ||
{ | ||
name: "VersionErrorHintMessageGetDocument", | ||
args: args{ | ||
request: &internalRequest{ | ||
functionName: "GetDocuments", | ||
}, | ||
mockedError: &Error{ | ||
Endpoint: "endpointForGetDocuments", | ||
Method: http.MethodPost, | ||
Function: "GetDocuments", | ||
RequestToString: "empty request", | ||
ResponseToString: "empty response", | ||
MeilisearchApiError: meilisearchApiError{ | ||
Message: "empty Meilisearch message", | ||
}, | ||
StatusCode: 1, | ||
rawMessage: "empty message", | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
err := VersionErrorHintMessage(tt.args.mockedError, tt.args.request) | ||
require.Error(t, err) | ||
fmt.Println(err) | ||
require.Equal(t, tt.args.mockedError.Error()+". Hint: It might not be working because you're not up to date with the Meilisearch version that "+tt.args.request.functionName+" call requires.", err.Error()) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.