Files
story/internal/idempotency/executor_test.go
T

21 lines
512 B
Go
Raw Normal View History

2026-08-26 06:41:07 +08:00
package idempotency
import "testing"
func TestHashIsStable(t *testing.T) {
first := Hash([]byte(`{"name":"test"}`))
second := Hash([]byte(`{"name":"test"}`))
if first != second || len(first) != 64 {
t.Fatalf("unexpected hashes: %q %q", first, second)
}
if first == Hash([]byte(`{"name":"other"}`)) {
t.Fatal("different bodies should not have the same hash")
}
}
func TestValidateRequest(t *testing.T) {
if err := validateRequest(Request{}); err == nil {
t.Fatal("empty request should fail")
}
}