@@ -31,7 +31,7 @@ use std::{fs, path::Path};
31
31
/// }
32
32
/// ```
33
33
#[ derive( Clone , Debug , Default , PartialEq , Serialize , Deserialize ) ]
34
- #[ serde( rename_all( deserialize = "kebab-case" ) ) ]
34
+ #[ serde( rename_all = "kebab-case" ) ]
35
35
pub struct ComputedFile {
36
36
pub deterministic_output_path : Option < String > ,
37
37
pub callback_data : Option < String > ,
@@ -304,6 +304,29 @@ mod tests {
304
304
305
305
const TEST_TASK_ID : & str = "0x123456789abcdef" ;
306
306
307
+ #[ test]
308
+ fn computed_file_serializes_to_kebab_case ( ) {
309
+ let file = ComputedFile {
310
+ deterministic_output_path : Some ( "/iexec_out/result.txt" . to_string ( ) ) ,
311
+ callback_data : Some ( "0xabc" . to_string ( ) ) ,
312
+ task_id : Some ( TEST_TASK_ID . to_string ( ) ) ,
313
+ result_digest : Some ( "0xdef" . to_string ( ) ) ,
314
+ enclave_signature : Some ( "0xsig" . to_string ( ) ) ,
315
+ error_message : Some ( "err" . to_string ( ) ) ,
316
+ } ;
317
+ let expected = r#"{
318
+ "deterministic-output-path":"/iexec_out/result.txt",
319
+ "callback-data":"0xabc",
320
+ "task-id":"0x123456789abcdef",
321
+ "result-digest":"0xdef",
322
+ "enclave-signature":"0xsig",
323
+ "error-message":"err"
324
+ }"# ;
325
+ let expected_value: serde_json:: Value = serde_json:: from_str ( expected) . unwrap ( ) ;
326
+ let actual_value: serde_json:: Value = serde_json:: json!( & file) ;
327
+ assert_eq ! ( actual_value, expected_value) ;
328
+ }
329
+
307
330
// region read_computed_file
308
331
#[ test]
309
332
fn read_computed_file_returns_computed_file_when_valid_input ( ) {
0 commit comments