@@ -76,7 +76,7 @@ mod tests {
76
76
pub cardano_transactions_prover : Option < CardanoTransactionsProverCapabilities > ,
77
77
}
78
78
79
- fn golden_message_v1 ( ) -> AggregatorFeaturesMessagePrevious {
79
+ fn golden_message_previous ( ) -> AggregatorFeaturesMessagePrevious {
80
80
AggregatorFeaturesMessagePrevious {
81
81
open_api_version : "0.0.1" . to_string ( ) ,
82
82
documentation_url : "https://example.com" . to_string ( ) ,
@@ -91,7 +91,7 @@ mod tests {
91
91
}
92
92
}
93
93
94
- fn golden_message_v2 ( ) -> AggregatorFeaturesMessage {
94
+ fn golden_message_actual ( ) -> AggregatorFeaturesMessage {
95
95
AggregatorFeaturesMessage {
96
96
open_api_version : "0.0.1" . to_string ( ) ,
97
97
documentation_url : "https://example.com" . to_string ( ) ,
@@ -110,44 +110,35 @@ mod tests {
110
110
}
111
111
}
112
112
113
- // Test the retro compatibility with possible future upgrades.
114
- # [ test ]
115
- fn test_v1 ( ) {
116
- let json = r#" {
117
- "open_api_version ": "0.0.1" ,
118
- "documentation_url ": "https://example.com",
119
- "capabilities ": {
120
- "signed_entity_types": ["CardanoTransactions"] ,
121
- "cardano_transactions_prover ": {
122
- "max_hashes_allowed_by_request ": 100
123
- }
113
+ const ACTUAL_JSON : & str = r#"{
114
+ "open_api_version": "0.0.1",
115
+ "documentation_url": "https://example.com",
116
+ "capabilities": {
117
+ "signed_entity_types ": ["CardanoTransactions"] ,
118
+ "cardano_transactions_prover ": {
119
+ "max_hashes_allowed_by_request ": 100
120
+ } ,
121
+ "cardano_transactions_signing_config ": {
122
+ "security_parameter ": 70,
123
+ "step": 20
124
124
}
125
- }"# ;
125
+ }
126
+ }"# ;
126
127
128
+ // Test the retro compatibility with possible future upgrades.
129
+ #[ test]
130
+ fn test_actual_json_deserialized_into_previous_message ( ) {
131
+ let json = ACTUAL_JSON ;
127
132
let message: AggregatorFeaturesMessagePrevious = serde_json:: from_str ( json) . unwrap ( ) ;
128
133
129
- assert_eq ! ( golden_message_v1 ( ) , message) ;
134
+ assert_eq ! ( golden_message_previous ( ) , message) ;
130
135
}
131
136
132
137
#[ test]
133
- fn test_v2 ( ) {
134
- let json = r#"{
135
- "open_api_version": "0.0.1",
136
- "documentation_url": "https://example.com",
137
- "capabilities": {
138
- "signed_entity_types": ["CardanoTransactions"],
139
- "cardano_transactions_prover": {
140
- "max_hashes_allowed_by_request": 100
141
- },
142
- "cardano_transactions_signing_config": {
143
- "security_parameter": 70,
144
- "step": 20
145
- }
146
- }
147
- }"# ;
148
-
138
+ fn test_actual_json_deserialized_into_actual_message ( ) {
139
+ let json = ACTUAL_JSON ;
149
140
let message: AggregatorFeaturesMessage = serde_json:: from_str ( json) . unwrap ( ) ;
150
141
151
- assert_eq ! ( golden_message_v2 ( ) , message) ;
142
+ assert_eq ! ( golden_message_actual ( ) , message) ;
152
143
}
153
144
}
0 commit comments