use super::common::{create_config, fixture_path};
#[test]
fn entry_exports_skipped_by_default() {
let root = fixture_path("entry-export-validation");
let config = create_config(root);
let results = fallow_core::analyze(&config).expect("analysis should succeed");
let unused_export_names: Vec<&str> = results
.unused_exports
.iter()
.map(|e| e.export_name.as_str())
.collect();
assert!(
!unused_export_names.contains(&"meatdata"),
"meatdata should not be flagged (entry exports skipped by default), found: {unused_export_names:?}"
);
assert!(
!unused_export_names.contains(&"config"),
"config should not be flagged (entry exports skipped by default), found: {unused_export_names:?}"
);
}
#[test]
fn entry_exports_detected_when_include_entry_exports_enabled() {
let root = fixture_path("entry-export-validation");
let mut config = create_config(root);
config.include_entry_exports = true;
let results = fallow_core::analyze(&config).expect("analysis should succeed");
let unused_export_names: Vec<&str> = results
.unused_exports
.iter()
.map(|e| e.export_name.as_str())
.collect();
assert!(
unused_export_names.contains(&"meatdata"),
"meatdata should be flagged with include_entry_exports, found: {unused_export_names:?}"
);
assert!(
unused_export_names.contains(&"config"),
"config should be flagged with include_entry_exports, found: {unused_export_names:?}"
);
assert!(
!unused_export_names.contains(&"helper"),
"helper should not be flagged (imported by consumer.ts), found: {unused_export_names:?}"
);
}