22 lines
529 B
Go
22 lines
529 B
Go
package storage
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sundynix/pets-be/internal/config"
|
|
)
|
|
|
|
func TestPublicURLUsesEndpoint(t *testing.T) {
|
|
store, err := New(config.MinIOConfig{
|
|
Endpoint: "https://s3.sundynix.cn", AccessKey: "test", SecretKey: "test", Bucket: "sundynix-pet",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got := store.PublicURL("files/2026-10-01/corgi photo.png")
|
|
want := "https://s3.sundynix.cn/sundynix-pet/files/2026-10-01/corgi%20photo.png"
|
|
if got != want {
|
|
t.Fatalf("PublicURL() = %q, want %q", got, want)
|
|
}
|
|
}
|