aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralpaylan2021-04-14 03:07:10 +0300
committeralpaylan2021-04-14 03:07:10 +0300
commitc5eeb6a8ba775782802e85e7e9ce47e5faff1e06 (patch)
tree671e36e9043d240ce6f10c35552156cbb35868fc
parent5b21949de754c2dab1f93c59c9be2497f3b321ba (diff)
downloadgradecoin-c5eeb6a8ba775782802e85e7e9ce47e5faff1e06.tar.gz
gradecoin-c5eeb6a8ba775782802e85e7e9ce47e5faff1e06.tar.bz2
gradecoin-c5eeb6a8ba775782802e85e7e9ce47e5faff1e06.zip
fix the serde if tests.
-rw-r--r--tests/schema_tests.rs26
1 files changed, 19 insertions, 7 deletions
diff --git a/tests/schema_tests.rs b/tests/schema_tests.rs
index 35ed6e6..c1880b9 100644
--- a/tests/schema_tests.rs
+++ b/tests/schema_tests.rs
@@ -126,11 +126,16 @@ mod tests {
126 } 126 }
127 127
128 #[test] 128 #[test]
129 fn block_deserialize_when_vec_emptpy() { 129 fn block_serialize_when_vec_emptpy() {
130 // let data = r#"{"transaction_list":[],"nonce":0,"timestamp":"2021-04-02T04:02:42","hash":"hash"}"#; 130 let block = Block {
131 // let err: Error = serde_json::from_str::<Block>(data).unwrap_err(); 131 transaction_list: vec![],
132 // 132 nonce: 0,
133 // assert_eq!(err.is_data(), true); 133 timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
134 hash: "hash".to_owned()
135 };
136
137 let json = serde_json::to_string(&block).unwrap();
138 assert_eq!(json, r#"{"nonce":0,"timestamp":"2021-04-02T04:02:42","hash":"hash"}"#)
134 } 139 }
135 140
136 #[test] 141 #[test]
@@ -173,8 +178,15 @@ mod tests {
173 } 178 }
174 179
175 #[test] 180 #[test]
176 fn naked_block_deserialize_when_vec_emptpy() { 181 fn naked_block_serialize_when_vec_emptpy() {
177 // 182 let naked_block = NakedBlock {
183 transaction_list: vec![],
184 nonce: 0,
185 timestamp: NaiveDate::from_ymd(2021, 4, 2).and_hms(4, 2, 42),
186 };
187
188 let json = serde_json::to_string(&naked_block).unwrap();
189 assert_eq!(json, r#"{"nonce":0,"timestamp":"2021-04-02T04:02:42"}"#)
178 } 190 }
179 191
180 #[test] 192 #[test]