chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user