package cache import ( "encoding/hex" "testing" ) func TestTokenHashStableAndNotPlainToken(t *testing.T) { h := TokenHash("secret-token") if h == "secret-token" || h == "" { t.Fatalf("hash=%q", h) } if _, err := hex.DecodeString(h); err != nil { t.Fatalf("not hex: %v", err) } if TokenHash("secret-token") != h { t.Fatal("not stable") } if TokenHash("other") == h { t.Fatal("collision") } }