From 8ded72af8b955fc5fcac02e3f012119edf6b5628 Mon Sep 17 00:00:00 2001 From: Bruce Riley Date: Wed, 25 Jan 2023 21:08:27 +0000 Subject: [PATCH] Node/Acct: Add another test Change-Id: I64e37072e77e199f5ff21300ecd9c20aa81a0b5a --- node/pkg/accountant/query_test.go | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/node/pkg/accountant/query_test.go b/node/pkg/accountant/query_test.go index 2a559b54e..04a16522b 100644 --- a/node/pkg/accountant/query_test.go +++ b/node/pkg/accountant/query_test.go @@ -15,7 +15,32 @@ import ( ) func TestParseMissingObservationsResponse(t *testing.T) { - //TODO: Write this test once we get a sample response. + responsesJson := []byte("{\"missing\":[{\"chain_id\":2,\"tx_hash\":\"y1E+jwgozWKEVbHt9dIeErgNXlHnntQwdzymYSCmBEA=\"},{\"chain_id\":4,\"tx_hash\":\"FZyF7xR5bIwtvdBIlIrDEZc+mrCkN/ixjGazgJdJdQQ=\"}]}") + var response MissingObservationsResponse + err := json.Unmarshal(responsesJson, &response) + require.NoError(t, err) + require.Equal(t, 2, len(response.Missing)) + + expectedTxHash0, err := hex.DecodeString("cb513e8f0828cd628455b1edf5d21e12b80d5e51e79ed430773ca66120a60440") + require.NoError(t, err) + + expectedTxHash1, err := hex.DecodeString("159c85ef14796c8c2dbdd048948ac311973e9ab0a437f8b18c66b38097497504") + require.NoError(t, err) + + expectedResult := MissingObservationsResponse{ + Missing: []MissingObservation{ + MissingObservation{ + ChainId: uint16(vaa.ChainIDEthereum), + TxHash: expectedTxHash0, + }, + MissingObservation{ + ChainId: uint16(vaa.ChainIDBSC), + TxHash: expectedTxHash1, + }, + }, + } + + assert.Equal(t, expectedResult, response) } func TestParseBatchTransferStatusCommittedResponse(t *testing.T) {