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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user