File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -67,24 +67,23 @@ impl Serialize for BalancesMap {
67
67
#[ cfg( test) ]
68
68
mod test {
69
69
use super :: * ;
70
+ use crate :: util:: tests:: prep_db:: IDS ;
70
71
use crate :: BigNum ;
71
72
72
73
#[ test]
73
- fn test_map ( ) {
74
+ fn test_balances_map_serialization ( ) {
74
75
let data = vec ! [
75
- (
76
- "0xce07CbB7e054514D590a0262C93070D838bFBA2e" . to_string( ) ,
77
- BigNum :: from( 50_u64 ) ,
78
- ) ,
79
- (
80
- "0x061d5e2a67d0a9a10f1c732bca12a676d83f79663a396f7d87b3e30b9b411088" . to_string( ) ,
81
- BigNum :: from( 100_u64 ) ,
82
- ) ,
76
+ ( IDS [ "leader" ] . clone( ) , BigNum :: from( 50_u64 ) ) ,
77
+ ( IDS [ "follower" ] . clone( ) , BigNum :: from( 100_u64 ) ) ,
83
78
] ;
84
79
85
80
let balances_map: BalancesMap = data. into_iter ( ) . collect ( ) ;
86
81
87
82
let actual_json = serde_json:: to_string ( & balances_map) . expect ( "Should serialize it" ) ;
83
+ // should be all lowercase!
84
+ let expected_json = r#"{"0xc91763d7f14ac5c5ddfbcd012e0d2a61ab9bded3":"100","0xce07cbb7e054514d590a0262c93070d838bfba2e":"50"}"# ;
85
+
86
+ assert_eq ! ( expected_json, actual_json) ;
88
87
89
88
let balances_map_from_json: BalancesMap =
90
89
serde_json:: from_str ( & actual_json) . expect ( "Should deserialize it" ) ;
You can’t perform that action at this time.
0 commit comments