Files
mtusi2026lab5/internal/platform/objectstore/s3_test.go
T
2026-10-29 23:36:12 +03:00

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)
}