package customer import ( "net/http" "testing" ) func TestParseMoneyCentsExact(t *testing.T) { cases := map[string]int64{ "0": 0, "1": 100, "1.2": 120, "1.20": 120, "499.99": 49999, } for in, want := range cases { got, err := parseMoneyCents(in) if err != nil || got != want { t.Fatalf("parseMoneyCents(%q) = %d, %v; want %d", in, got, err, want) } } for _, in := range []string{"", "-1.00", "+1.00", "1.234", "1,00", "abc"} { if _, err := parseMoneyCents(in); err == nil { t.Fatalf("parseMoneyCents(%q) should fail", in) } } } func TestCustomerCookieUsesLaxAndAdminStrict(t *testing.T) { s := &Service{} if got := s.cookieSameSite(customerCookie); got != http.SameSiteLaxMode { t.Fatalf("customer cookie SameSite = %v; want Lax", got) } if got := s.cookieSameSite(csAdminCookie); got != http.SameSiteStrictMode { t.Fatalf("admin cookie SameSite = %v; want Strict", got) } }