refactor: remove unnecessary if checks and add test to handle getting null file
This commit is contained in:
@@ -2331,6 +2331,26 @@ public class AnthropicApiClientTests : IntegrationTest
|
||||
result.Error.Error.Should().BeOfType<InvalidRequestError>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetFileAsync_WhenCalledAndCanNotDeserializeResponse_ItShouldReturnError()
|
||||
{
|
||||
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenGetFileContentRequest(fileId)
|
||||
.Respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
"application/json",
|
||||
@"null"
|
||||
);
|
||||
|
||||
var result = await Client.GetFileAsync(fileId);
|
||||
|
||||
result.IsSuccess.Should().BeFalse();
|
||||
result.Error.Should().BeOfType<AnthropicError>();
|
||||
result.Error.Error.Should().BeOfType<ApiError>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteFileAsync_WhenCalled_ItShouldReturnDeletionResponse()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user