Fix parse tests

This commit is contained in:
Patrick O'Grady 2020-11-13 11:34:24 -08:00
parent 27faa31c7a
commit f3d07c5e0f
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85

View file

@ -706,7 +706,6 @@ func mustMarshalMap(v interface{}) map[string]interface{} {
} }
func TestParseBlock(t *testing.T) { func TestParseBlock(t *testing.T) {
status := SuccessStatus
tests := map[string]struct { tests := map[string]struct {
block *Block block *Block
coins map[string]*storage.AccountCoin coins map[string]*storage.AccountCoin
@ -736,7 +735,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: CoinbaseOpType, Type: CoinbaseOpType,
Status: &status, Status: types.String(SuccessStatus),
Metadata: mustMarshalMap(&OperationMetadata{ Metadata: mustMarshalMap(&OperationMetadata{
Coinbase: "04ffff001d02fd04", Coinbase: "04ffff001d02fd04",
Sequence: 4294967295, Sequence: 4294967295,
@ -748,7 +747,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "4104f5eeb2b10c944c6b9fbcfff94c35bdeecd93df977882babc7f3a2cf7f5c81d3b09a68db7f0e04f21de5d4230e75e6dbe7ad16eefe0d4325a62067dc6f369446aac", // nolint Address: "4104f5eeb2b10c944c6b9fbcfff94c35bdeecd93df977882babc7f3a2cf7f5c81d3b09a68db7f0e04f21de5d4230e75e6dbe7ad16eefe0d4325a62067dc6f369446aac", // nolint
}, },
@ -789,7 +788,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "mmtKKnjqTPdkBnBMbNt5Yu2SCwpMaEshEL", // nolint Address: "mmtKKnjqTPdkBnBMbNt5Yu2SCwpMaEshEL", // nolint
}, },
@ -821,7 +820,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(1), NetworkIndex: int64Pointer(1),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "4852fe372ff7534c16713b3146bbc1e86379c70bea4d5c02fb1fa0112980a081:1", Address: "4852fe372ff7534c16713b3146bbc1e86379c70bea4d5c02fb1fa0112980a081:1",
}, },
@ -929,7 +928,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: CoinbaseOpType, Type: CoinbaseOpType,
Status: &status, Status: types.String(SuccessStatus),
Metadata: mustMarshalMap(&OperationMetadata{ Metadata: mustMarshalMap(&OperationMetadata{
Coinbase: "044c86041b020602", Coinbase: "044c86041b020602",
Sequence: 4294967295, Sequence: 4294967295,
@ -941,7 +940,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "34qkc2iac6RsyxZVfyE2S5U5WcRsbg2dpK", Address: "34qkc2iac6RsyxZVfyE2S5U5WcRsbg2dpK",
}, },
@ -973,7 +972,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(1), NetworkIndex: int64Pointer(1),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "6a24aa21a9ed10109f4b82aa3ed7ec9d02a2a90246478b3308c8b85daf62fe501d58d05727a4", Address: "6a24aa21a9ed10109f4b82aa3ed7ec9d02a2a90246478b3308c8b85daf62fe501d58d05727a4",
}, },
@ -1008,7 +1007,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: InputOpType, Type: InputOpType,
Status: &status, Status: types.String(SuccessStatus),
Amount: &types.Amount{ Amount: &types.Amount{
Value: "-5000000000", Value: "-5000000000",
Currency: MainnetCurrency, Currency: MainnetCurrency,
@ -1036,7 +1035,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "1JqDybm2nWTENrHvMyafbSXXtTk5Uv5QAn", Address: "1JqDybm2nWTENrHvMyafbSXXtTk5Uv5QAn",
}, },
@ -1068,7 +1067,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(1), NetworkIndex: int64Pointer(1),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "1EYTGtG4LnFfiMvjJdsU7GMGCQvsRSjYhx", Address: "1EYTGtG4LnFfiMvjJdsU7GMGCQvsRSjYhx",
}, },
@ -1113,7 +1112,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: InputOpType, Type: InputOpType,
Status: &status, Status: types.String(SuccessStatus),
Amount: &types.Amount{ Amount: &types.Amount{
Value: "-3467607", Value: "-3467607",
Currency: MainnetCurrency, Currency: MainnetCurrency,
@ -1145,7 +1144,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(1), NetworkIndex: int64Pointer(1),
}, },
Type: InputOpType, Type: InputOpType,
Status: &status, Status: types.String(SuccessStatus),
Amount: &types.Amount{ Amount: &types.Amount{
Value: "0", Value: "0",
Currency: MainnetCurrency, Currency: MainnetCurrency,
@ -1173,7 +1172,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(2), NetworkIndex: int64Pointer(2),
}, },
Type: InputOpType, Type: InputOpType,
Status: &status, Status: types.String(SuccessStatus),
Amount: &types.Amount{ Amount: &types.Amount{
Value: "-556000000", Value: "-556000000",
Currency: MainnetCurrency, Currency: MainnetCurrency,
@ -1201,7 +1200,7 @@ func TestParseBlock(t *testing.T) {
NetworkIndex: int64Pointer(0), NetworkIndex: int64Pointer(0),
}, },
Type: OutputOpType, Type: OutputOpType,
Status: &status, Status: types.String(SuccessStatus),
Account: &types.AccountIdentifier{ Account: &types.AccountIdentifier{
Address: "76a914c398efa9c392ba6013c5e04ee729755ef7f58b3288ac", Address: "76a914c398efa9c392ba6013c5e04ee729755ef7f58b3288ac",
}, },