Skip to content

Commit

Permalink
chore: add case for getting rejected tx (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjchen7 authored Dec 5, 2022
1 parent 82c03a2 commit 5734118
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions rpc/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,25 @@ func TestClient_GetBlock(t *testing.T) {
func TestClient_GetTransaction(t *testing.T) {
txView, err := testClient.GetTransaction(ctx,
types.HexToHash("0x8277d74d33850581f8d843613ded0c2a1722dec0e87e748f45c115dfb14210f1"))
if err != nil {
t.Fatal(err)
}
assert.NoError(t, err)
tx := txView.Transaction
status := txView.TxStatus
assert.Equal(t, 4, len(tx.CellDeps))
assert.Equal(t, 1, len(tx.Inputs))
assert.Equal(t, 3, len(tx.Outputs))
assert.Equal(t, uint64(30000000000), tx.Outputs[0].Capacity)
assert.Equal(t, types.TransactionStatusCommitted, status.Status)
assert.NotNil(t, status.BlockHash)

txView, err = testClient.GetTransaction(ctx,
types.HexToHash("0xb2b8911aeac92de53fc3edc218cf979ae4752a7a67e698b0b1726db53126f31f"))
assert.NoError(t, err)
tx = txView.Transaction
status = txView.TxStatus
assert.Nil(t, tx)
assert.Equal(t, types.TransactionStatusRejected, status.Status)
assert.NotNil(t, status.Reason)
assert.Nil(t, status.BlockHash)
}

func TestClient_GetTipHeader(t *testing.T) {
Expand Down

0 comments on commit 5734118

Please sign in to comment.