fix cookie -- not working

This commit is contained in:
2026-05-12 11:25:32 +02:00
parent 669d24c6a3
commit 8c4e664ca8
23 changed files with 836 additions and 166 deletions
@@ -0,0 +1,27 @@
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")
}
}