Skip to content

Commit

Permalink
Add new unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Sep 15, 2023
1 parent c39b13d commit 9168b38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/algodclientv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func AlgodClientV2Context(s *godog.Suite) {
s.Step(`^we make a GetLedgerStateDelta call against round (\d+)$`, weMakeAGetLedgerStateDeltaCallAgainstRound)
s.Step(`^we make a LedgerStateDeltaForTransactionGroupResponse call for ID "([^"]*)"$`, weMakeALedgerStateDeltaForTransactionGroupResponseCallForID)
s.Step(`^we make a TransactionGroupLedgerStateDeltaForRoundResponse call for round (\d+)$`, weMakeATransactionGroupLedgerStateDeltaForRoundResponseCallForRound)
s.Step(`^we make a GetBlockTxids call against block number (\d+)$`, weMakeAGetBlockTxidsCallAgainstBlockNumber)

s.BeforeScenario(func(interface{}) {
globalErrForExamination = nil
Expand Down Expand Up @@ -394,3 +395,12 @@ func weMakeATransactionGroupLedgerStateDeltaForRoundResponseCallForRound(round i
algodClient.GetTransactionGroupLedgerStateDeltasForRound(uint64(round)).Do(context.Background())
return nil
}

func weMakeAGetBlockTxidsCallAgainstBlockNumber(round int) error {
algodClient, err := algod.MakeClient(mockServer.URL, "")
if err != nil {
return err
}
algodClient.GetBlockTxids(uint64(round)).Do(context.Background())
return nil
}
3 changes: 3 additions & 0 deletions test/responses_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func weMakeAnyCallTo(client /* algod/indexer */, endpoint string) (err error) {
case "GetLedgerStateDeltaForTransactionGroup":
response, err =
algodC.GetLedgerStateDeltaForTransactionGroup("someID").Do(context.Background())
case "GetBlockTxids":
response, err =
algodC.GetBlockTxids(123).Do(context.Background())
case "any":
// This is an error case
// pickup the error as the response
Expand Down
2 changes: 2 additions & 0 deletions test/unit.tags
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@unit.applications.boxes
@unit.atomic_transaction_composer
@unit.blocksummary
@unit.blocktxids
@unit.dryrun
@unit.dryrun.trace.application
@unit.feetest
Expand All @@ -26,6 +27,7 @@
@unit.responses.participationupdates
@unit.responses.sync
@unit.responses.timestamp
@unit.responses.txid.json
@unit.responses.unlimited_assets
@unit.sourcemap
@unit.statedelta
Expand Down

0 comments on commit 9168b38

Please sign in to comment.