feat: add command domain invariants
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package domain
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestImmutableRequestReplay_HP_IDEM_02(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
first := HashImmutableRequest([]byte("method\x00target\x00payload"))
|
||||
same := HashImmutableRequest([]byte("method\x00target\x00payload"))
|
||||
other := HashImmutableRequest([]byte("method\x00other\x00payload"))
|
||||
if got := ClassifyReplay(nil, first); got != ReplayNew {
|
||||
t.Fatalf("new replay decision = %v", got)
|
||||
}
|
||||
if got := ClassifyReplay(&first, same); got != ReplayExact {
|
||||
t.Fatalf("exact replay decision = %v", got)
|
||||
}
|
||||
if got := ClassifyReplay(&first, other); got != ReplayConflict {
|
||||
t.Fatalf("conflicting replay decision = %v", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user