package webhook import "testing" func TestSign(t *testing.T) { if Sign("", []byte("hello")) != "" { t.Error("empty secret should return empty signature") } sig := Sign("supersecret", []byte("hello")) if len(sig) != 64 { t.Errorf("expected 64-char hex hmac, got %d: %q", len(sig), sig) } again := Sign("supersecret", []byte("hello")) if sig != again { t.Error("signature should be deterministic") } other := Sign("different", []byte("hello")) if sig == other { t.Error("different secret should produce different signature") } }