MCPcopy Create free account
hub / github.com/ChainSafe/nodewatch-api / TestStreamHeaderAndPayload

Function TestStreamHeaderAndPayload

crawler/rpc/request/request_test.go:54–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestStreamHeaderAndPayload(t *testing.T) {
55 input, _ := hex.DecodeString("aabb1234")
56 r := bytes.NewReader(input)
57 var buf bytes.Buffer
58 err := StreamHeaderAndPayload(uint64(len(input)), r, &buf, nil) // no compression here
59 if err != nil {
60 t.Error(err)
61 }
62 expected, _ := hex.DecodeString("04aabb1234")
63 if !bytes.Equal(expected, buf.Bytes()) {
64 t.Error("unexpected encoding output")
65 }
66}

Callers

nothing calls this directly

Calls 1

StreamHeaderAndPayloadFunction · 0.85

Tested by

no test coverage detected