Test that the carry copies a group, a pull key and an unasked delivery byte for byte (review round 1)
This commit is contained in:
@@ -321,3 +321,24 @@ func TestAFailedCarryLeavesTheGateSilentAndUnmarked(t *testing.T) {
|
||||
t.Fatal("a failed carry wrote its mark")
|
||||
}
|
||||
}
|
||||
|
||||
// Review round 1, try failure: the carry copies a group, a pull key and a delivery without an unanswered ask byte for byte; what
|
||||
// the gate writes after it holds the seat and acts is its own (a group's said state), not the carry's.
|
||||
func TestTheCarryCopiesWhatItDoesNotClearByteForByte(t *testing.T) {
|
||||
f := aCarry(t)
|
||||
group := []byte(`{"id":"feat/x","members":["novox/app@aaaaaaaaaaaa"],"created":"2026-10-09T07:00:00Z","updated":"2026-10-09T07:00:00Z","said":"delivering"}`)
|
||||
f.oldG["feat_x"] = group
|
||||
plain := aDelivery("novox/app@eeeeeeeeeeee", 11, nil)
|
||||
f.oldD["novox/app@eeeeeeeeeeee"] = plain
|
||||
if err := f.w.h.SeatChanged(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, c := range []struct {
|
||||
bucket, key string
|
||||
want []byte
|
||||
}{{"groups", "feat_x", group}, {"pulls", "novox_app_7", f.oldP["novox_app_7"]}, {"deliveries", "novox/app@eeeeeeeeeeee", plain}} {
|
||||
if got, _ := f.own[c.bucket].Get(c.key); !bytes.Equal(got, c.want) {
|
||||
t.Fatalf("%s %s changed in the carry:\n got %s\nwant %s", c.bucket, c.key, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user