- Remove PayPal donate URL from .github/FUNDING.yml (keep saweria), fix trailing whitespace - Update anyhow 1.0.102 -> 1.0.104 (RUSTSEC-2026-0190 unsoundness warning) - Fix 25 clippy warnings across src/ (idiomatic fixes; two justified #[allow(too_many_arguments)] on internal pass-through helpers) - Normalize formatting via cargo fmt - Correct stale version reference in AGENTS.md (1.32.4 -> 1.34.0)
65 lines
1.7 KiB
Rust
65 lines
1.7 KiB
Rust
use std::fs;
|
|
use std::path::PathBuf;
|
|
|
|
fn get_fixture_path(name: &str) -> PathBuf {
|
|
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
|
path.push("tests/fixtures");
|
|
path.push(name);
|
|
path
|
|
}
|
|
|
|
#[test]
|
|
fn test_fixtures_exist() {
|
|
let fixtures = vec![
|
|
"sample_deals.csv",
|
|
"sample_report.htm",
|
|
"sample_report.htm.xml",
|
|
];
|
|
|
|
for fixture in fixtures {
|
|
let path = get_fixture_path(fixture);
|
|
assert!(path.exists(), "Fixture {} should exist", fixture);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_sample_deals_csv_format() {
|
|
let path = get_fixture_path("sample_deals.csv");
|
|
let content = fs::read_to_string(path).expect("Should read sample_deals.csv");
|
|
|
|
// Check CSV has header and data rows
|
|
let lines: Vec<&str> = content.lines().collect();
|
|
assert!(!lines.is_empty(), "CSV should have at least a header");
|
|
|
|
// Check for expected columns in header
|
|
let header = lines[0];
|
|
assert!(
|
|
header.contains("Time") || header.contains("time"),
|
|
"Header should contain Time column"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn test_sample_report_html_format() {
|
|
let path = get_fixture_path("sample_report.htm");
|
|
let content = fs::read_to_string(path).expect("Should read sample_report.htm");
|
|
|
|
// Check HTML structure
|
|
assert!(
|
|
content.contains("<html") || content.contains("<table"),
|
|
"Report should contain HTML or table elements"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn test_sample_report_xml_format() {
|
|
let path = get_fixture_path("sample_report.htm.xml");
|
|
let content = fs::read_to_string(path).expect("Should read sample_report.htm.xml");
|
|
|
|
// Check XML structure
|
|
assert!(
|
|
content.contains("<?xml") || content.contains("<Workbook"),
|
|
"Report should contain XML or Workbook elements"
|
|
);
|
|
}
|