Add more tests (#241)

* add form builder tests

* lint

* add client tests

* lint

* add non-existent file test
This commit is contained in:
sashabaranov
2023-04-09 18:36:15 +04:00
committed by GitHub
parent 334ee6dbdd
commit 9a1ecf5f4a
5 changed files with 125 additions and 27 deletions

View File

@@ -126,3 +126,17 @@ func TestFileUploadWithFailingFormBuilder(t *testing.T) {
_, err = client.CreateFile(ctx, req)
checks.ErrorIs(t, err, mockError, "CreateFile should return error if form builder fails")
}
func TestFileUploadWithNonExistentPath(t *testing.T) {
config := DefaultConfig("")
config.BaseURL = ""
client := NewClientWithConfig(config)
ctx := context.Background()
req := FileRequest{
FilePath: "some non existent file path/F616FD18-589E-44A8-BF0C-891EAE69C455",
}
_, err := client.CreateFile(ctx, req)
checks.ErrorIs(t, err, os.ErrNotExist, "CreateFile should return error if file does not exist")
}