dto.rs (1151B)
1 #[path = "generated/dto_roots.rs"] 2 mod generated_roots; 3 4 pub use generated_roots::dto_bindgen_roots as dto_roots; 5 6 #[cfg(test)] 7 mod tests { 8 use super::dto_roots; 9 10 #[test] 11 fn generated_core_roots_build_registry() { 12 let roots = dto_roots(); 13 let registry = dto_bindgen::export::build_registry(roots.iter().copied()); 14 15 assert!(!registry.has_errors()); 16 assert_eq!(registry.roots.len(), roots.len()); 17 } 18 19 #[test] 20 fn generated_core_roots_plan_typescript_bindings() { 21 let roots = dto_roots(); 22 let config_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) 23 .join("../..") 24 .join("dto_bindgen.toml"); 25 let report = dto_bindgen::export::plan_with_roots( 26 dto_bindgen::export::ExportOptions::new(config_path), 27 roots.iter().copied(), 28 ) 29 .unwrap(); 30 31 assert!(report.diagnostics.is_empty()); 32 assert_eq!(report.registry.roots.len(), roots.len()); 33 assert!(report.files.iter().any(|path| path.ends_with("types.ts"))); 34 assert!(report.files.iter().any(|path| path.ends_with("index.ts"))); 35 } 36 }