From f4c088afdc7c9d4ed8d6ac14989df85d1e436be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Sch=C3=B6ll?= Date: Mon, 10 Jun 2024 17:58:16 +0200 Subject: [PATCH] add test case for finality_data --- codec/antelope/spring_v1/types_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 codec/antelope/spring_v1/types_test.go diff --git a/codec/antelope/spring_v1/types_test.go b/codec/antelope/spring_v1/types_test.go new file mode 100644 index 0000000..15c7f6a --- /dev/null +++ b/codec/antelope/spring_v1/types_test.go @@ -0,0 +1,26 @@ +package antelope + +import ( + "encoding/hex" + "encoding/json" + "fmt" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestFinalityDataDecoding(t *testing.T) { + bytes, err := hex.DecodeString(strings.ReplaceAll(finalityDataInput1, "\n", "")) + require.NoError(t, err) + + finalityData := &FinalityData{} + require.NoError(t, unmarshalBinary(bytes, finalityData), err) + + finalityJson, err := json.Marshal(finalityData) + require.NoError(t, err) + + fmt.Println(string(finalityJson)) +} + +var finalityDataInput1 = `01000000000000000100000050f3c0f34771e2f2b8fcd27547f21fba504fa64708222d41336af632c19b1a887ab43c9132eb17408027d834d2c51e44fd4d51d82a09123f8a728c8a65109872`