Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add transaction unmarshal test
- Loading branch information
1 parent
1f17c84
commit 1a80725
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package blockfrost_test | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/blockfrost/blockfrost-go" | ||
) | ||
|
||
func TestTransactionContentUnmarshal(t *testing.T) { | ||
want := blockfrost.TransactionContent{ | ||
Hash: "1e043f100dce12d107f679685acd2fc0610e10f72a92d412794c9773d11d8477", | ||
Block: "356b7d7dbb696ccd12775c016941057a9dc70898d87a63fc752271bb46856940", | ||
BlockHeight: 123456, | ||
Slot: 42000000, | ||
Index: 1, | ||
OutputAmount: []struct { | ||
Quantity string `json:"quantity"` | ||
|
||
// The unit of the value | ||
Unit string `json:"unit"` | ||
}{}, | ||
Fees: "182485", | ||
Deposit: "0", | ||
Size: 433, | ||
InvalidBefore: "", | ||
InvalidHereafter: "13885913", | ||
UtxoCount: 4, | ||
} | ||
fp := filepath.Join(testdata, "json", "transactions", "transaction.json") | ||
got := blockfrost.TransactionContent{} | ||
testStructGotWant(t, fp, &got, &want) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"hash": "1e043f100dce12d107f679685acd2fc0610e10f72a92d412794c9773d11d8477", | ||
"block": "356b7d7dbb696ccd12775c016941057a9dc70898d87a63fc752271bb46856940", | ||
"block_height": 123456, | ||
"slot": 42000000, | ||
"index": 1, | ||
"output_amount": [], | ||
"fees": "182485", | ||
"deposit": "0", | ||
"size": 433, | ||
"invalid_before": null, | ||
"invalid_hereafter": "13885913", | ||
"utxo_count": 4, | ||
"withdrawal_count": 0, | ||
"mir_cert_count": 0, | ||
"delegation_count": 0, | ||
"stake_cert_count": 0, | ||
"pool_update_count": 0, | ||
"pool_retire_count": 0, | ||
"asset_mint_or_burn_count": 0, | ||
"redeemer_count": 0 | ||
} |