27 lines
627 B
Go
27 lines
627 B
Go
package objectstore
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/aws/smithy-go"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"mtusi-messenger/internal/domain"
|
|
)
|
|
|
|
func TestMapObjectErrorBucketIsUnavailable(t *testing.T) {
|
|
err := mapObjectError("put object", "key", &smithy.GenericAPIError{
|
|
Code: "NoSuchBucket",
|
|
Message: "bucket is missing",
|
|
})
|
|
require.ErrorIs(t, err, domain.ErrUnavailable)
|
|
}
|
|
|
|
func TestMapObjectErrorMissingKeyIsNotFound(t *testing.T) {
|
|
err := mapObjectError("open object", "key", &smithy.GenericAPIError{
|
|
Code: "NoSuchKey",
|
|
Message: "object is missing",
|
|
})
|
|
require.ErrorIs(t, err, domain.ErrNotFound)
|
|
}
|