package session import "testing" func TestPrestashopCookieDomain(t *testing.T) { if got := prestashopCookieDomain("localhost", nil); got != "" { t.Fatalf("prestashopCookieDomain(localhost) = %q, want empty", got) } if got := prestashopCookieDomain("shop.example.com", []string{"shop.example.com"}); got != ".example.com" { t.Fatalf("prestashopCookieDomain(shared) = %q, want %q", got, ".example.com") } if got := prestashopCookieDomain("shop.example.com", nil); got != "shop.example.com" { t.Fatalf("prestashopCookieDomain(single) = %q, want %q", got, "shop.example.com") } } func TestURIMatchesRequest(t *testing.T) { if !uriMatchesRequest("/shop/fr/", "/shop/fr/product/test") { t.Fatalf("expected nested shop URI to match request path") } if uriMatchesRequest("/shop/fr/", "/shop/en/product/test") { t.Fatalf("unexpected match for different shop URI") } }