Skip to content

Commit

Permalink
Add test for NotReceived transaction status
Browse files Browse the repository at this point in the history
Add unit test for GetTransaction RPC method handling the case when
feeder client returns starknet.NotReceived. The test verifies
that the error is properly propagated as errTransactionNotFound
  • Loading branch information
wojciechos committed Dec 9, 2024
1 parent 04289d5 commit 5e13b9f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rpc/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,17 @@ func TestTransactionStatus(t *testing.T) {
require.NotNil(t, err)
require.Equal(t, err, rpc.ErrTxnHashNotFound)
})

t.Run("not received", func(t *testing.T) {
mockReader := mocks.NewMockReader(mockCtrl)
notReceivedHash := test.notFoundTxHash

mockReader.EXPECT().TransactionByHash(notReceivedHash).Return(nil, db.ErrKeyNotFound)

handler := rpc.New(mockReader, nil, nil, "", log).WithFeeder(client)
_, err := handler.TransactionStatus(ctx, *notReceivedHash)
require.Equal(t, rpc.ErrTxnHashNotFound, err)
})
})
}
}

0 comments on commit 5e13b9f

Please sign in to comment.