Files
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

41 lines
860 B
Go

package woocommerce
import (
"errors"
"testing"
)
func TestNormalizeStoreURLHTTPS(t *testing.T) {
got, err := NormalizeStoreURL("https://example.com/shop/")
if err != nil {
t.Fatal(err)
}
if got != "https://example.com/shop" {
t.Fatalf("got %q", got)
}
}
func TestNormalizeStoreURLBlocksPrivateIP(t *testing.T) {
_, err := NormalizeStoreURL("https://192.168.1.10")
if !errors.Is(err, ErrBlockedStoreURL) {
t.Fatalf("expected blocked, got %v", err)
}
}
func TestNormalizeStoreURLRejectsPlainHTTPRemote(t *testing.T) {
_, err := NormalizeStoreURL("http://example.com")
if err == nil {
t.Fatal("expected error")
}
}
func TestNormalizeStoreURLAllowsLocalhostHTTP(t *testing.T) {
got, err := NormalizeStoreURL("http://127.0.0.1:8080")
if err != nil {
t.Fatal(err)
}
if got != "http://127.0.0.1:8080" {
t.Fatalf("got %q", got)
}
}