vex2pdf 4.0.0

A tool to convert CycloneDX(VEX) JSON or XML documents to PDF reports
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
use std::path::Path;
use std::process::Command;
use tempfile::TempDir;

mod common;

use common::paths;
use common::utils;

/// Helper function to run the vex2pdf command and verify success
fn run_vex2pdf(
    input_path: &str,
    output_dir: &Path,
    extra_args: Option<Vec<&str>>,
) -> std::process::Output {
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(output_dir)
        .args(extra_args.unwrap_or(vec![]))
        .arg(input_path)
        .output()
        .expect("Failed to execute command");

    let output = output;
    // Print stderr for debugging if not empty
    if !output.stderr.is_empty() {
        eprintln!("stderr: {}", utils::bytes_to_str(&output.stderr));
    }

    // Assert command succeeded
    assert!(
        output.status.success(),
        "Command failed with status: {}",
        output.status
    );

    // Assert success message
    utils::assert_output_contains(&output.stdout, "Successfully generated PDF:");

    output
}

/// Helper function to get the expected PDF filename from input path
fn get_expected_pdf_name(input_path: &str) -> String {
    let path = Path::new(input_path);
    let stem = path.file_stem().unwrap().to_str().unwrap();
    format!("{}.pdf", stem)
}

// ============================================================================
// JSON BOM Tests
// ============================================================================

#[test]
fn test_simple_bom_with_one_vuln() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::SIMPLE_BOM_PATH, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::SIMPLE_BOM_PATH);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vdr_minimal_with_vulns() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_MINIMAL_WITH_VULNS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_MINIMAL_WITH_VULNS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vdr_with_ghsa_entries() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_WITH_GHSA_ENTRIES, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_GHSA_ENTRIES);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vdr_with_many_vulns() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_WITH_MANY_VULNS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_MANY_VULNS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vdr_with_no_vulns() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_WITH_NO_VULNS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_NO_VULNS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vdr_with_links_as_versions() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_WITH_LINKS_AS_VERSIONS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_LINKS_AS_VERSIONS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vex_with_links_as_versions() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VEX_WITH_LINKS_AS_VERSIONS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VEX_WITH_LINKS_AS_VERSIONS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_novulns_directory() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_NOVULNS, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_NOVULNS);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

// ============================================================================
// XML BOM Tests
// ============================================================================

#[test]
fn test_vdr_simple_xml() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VDR_SIMPLE_XML, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_SIMPLE_XML);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_vex_simple_xml() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::BOM_VEX_SIMPLE_XML, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::BOM_VEX_SIMPLE_XML);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

#[test]
fn test_sample_vex_xml() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    run_vex2pdf(paths::SAMPLE_VEX_XML, temp_dir.path(), None);

    let pdf_name = get_expected_pdf_name(paths::SAMPLE_VEX_XML);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
    utils::assert_pdf_checksum_matches(&generated_pdf);
}

// ============================================================================
// Batch Processing Tests
// ============================================================================

#[test]
fn test_batch_run_test_directory() {
    // Test batch processing of all files in run_test directory
    let temp_input_dir = TempDir::new().expect("Failed to create temp input dir");
    let temp_output_dir = TempDir::new().expect("Failed to create temp output dir");

    // Copy all test files from run_test directory
    let src_dir = Path::new(paths::SOURCE_BOMS_BASE_ARTIFACTS_DIR);
    let files_copied = utils::copy_directory_files(
        src_dir,
        temp_input_dir.path(),
        Some(vec!["_titles_override"]),
    )
    .expect("Failed to copy files");

    assert!(
        files_copied > 0,
        "No files were copied from run_test directory"
    );

    // Count expected processable files
    let expected_count = utils::count_processable_files(temp_input_dir.path());

    // Run vex2pdf on the directory
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_output_dir.path())
        .arg(temp_input_dir.path())
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "Batch processing failed: {}",
        utils::bytes_to_str(&output.stderr)
    );

    // Verify correct number of PDFs created
    utils::assert_pdf_count(temp_output_dir.path(), expected_count);

    // Verify each PDF matches expected output
    for entry in std::fs::read_dir(temp_output_dir.path()).unwrap() {
        let entry = entry.unwrap();
        let generated_pdf = entry.path();
        if generated_pdf.extension().and_then(|e| e.to_str()) == Some("pdf") {
            utils::assert_pdf_checksum_matches(&generated_pdf);
        }
    }
}

#[test]
fn test_batch_run_test_xml_directory() {
    // Test batch processing of all files in run_test_xml directory
    let temp_input_dir = TempDir::new().expect("Failed to create temp input dir");
    let temp_output_dir = TempDir::new().expect("Failed to create temp output dir");

    // Copy all test files from run_test_xml directory
    let src_dir = Path::new(paths::SOURCE_BOMS_XML_ARTIFACTS_DIR);
    let files_copied = utils::copy_directory_files(
        src_dir,
        temp_input_dir.path(),
        Some(vec!["_titles_override"]),
    )
    .expect("Failed to copy files");

    assert!(
        files_copied > 0,
        "No files were copied from run_test_xml directory"
    );

    // Count expected processable files
    let expected_count = utils::count_processable_files(temp_input_dir.path());

    // Run vex2pdf on the directory
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_output_dir.path())
        .arg(temp_input_dir.path())
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "Batch processing failed: {}",
        utils::bytes_to_str(&output.stderr)
    );

    // Verify correct number of PDFs created
    utils::assert_pdf_count(temp_output_dir.path(), expected_count);

    // Verify each PDF matches expected output
    for entry in std::fs::read_dir(temp_output_dir.path()).unwrap() {
        let entry = entry.unwrap();
        let generated_pdf = entry.path();
        if generated_pdf.extension().and_then(|e| e.to_str()) == Some("pdf") {
            utils::assert_pdf_checksum_matches(&generated_pdf);
        }
    }
}

#[test]
fn test_batch_no_args_current_directory() {
    // Test batch processing with no arguments (scans current directory)
    let temp_work_dir = TempDir::new().expect("Failed to create temp work dir");

    // Copy a few test files to the working directory
    std::fs::copy(
        paths::SIMPLE_BOM_PATH,
        temp_work_dir.path().join("test1.json"),
    )
    .expect("Failed to copy test file");

    std::fs::copy(
        paths::BOM_VDR_WITH_NO_VULNS,
        temp_work_dir.path().join("test2.json"),
    )
    .expect("Failed to copy test file");

    std::fs::copy(
        paths::BOM_VDR_SIMPLE_XML,
        temp_work_dir.path().join("test3.xml"),
    )
    .expect("Failed to copy test file");

    let expected_count = 3;

    // Run vex2pdf with NO arguments from that directory
    let output = Command::new(paths::PATH_TO_EXE)
        .current_dir(temp_work_dir.path())
        .output()
        .expect("Failed to execute command");

    assert!(
        output.status.success(),
        "Batch processing in current dir failed: {}",
        utils::bytes_to_str(&output.stderr)
    );

    // Verify PDFs were created in the same directory
    utils::assert_pdf_count(temp_work_dir.path(), expected_count);

    // Verify specific PDFs exist
    utils::assert_pdf_created(&temp_work_dir.path().join("test1.pdf"));
    utils::assert_pdf_created(&temp_work_dir.path().join("test2.pdf"));
    utils::assert_pdf_created(&temp_work_dir.path().join("test3.pdf"));
}

#[test]
fn test_batch_non_recursive_scanning() {
    // Test that directory scanning is non-recursive (only first level)
    let temp_input_dir = TempDir::new().expect("Failed to create temp input dir");
    let temp_output_dir = TempDir::new().expect("Failed to create temp output dir");

    // Create a subdirectory with a file
    let subdir = temp_input_dir.path().join("subdir");
    std::fs::create_dir(&subdir).expect("Failed to create subdir");

    std::fs::copy(paths::SIMPLE_BOM_PATH, subdir.join("nested.json"))
        .expect("Failed to copy to subdir");

    // Put files in the main directory
    std::fs::copy(
        paths::BOM_VDR_WITH_NO_VULNS,
        temp_input_dir.path().join("top_level1.json"),
    )
    .expect("Failed to copy to main dir");

    std::fs::copy(
        paths::BOM_VDR_SIMPLE_XML,
        temp_input_dir.path().join("top_level2.xml"),
    )
    .expect("Failed to copy to main dir");

    // Run vex2pdf on the directory
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_output_dir.path())
        .arg(temp_input_dir.path())
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success());

    // Only top-level files should be processed (2 files)
    utils::assert_pdf_count(temp_output_dir.path(), 2);

    // Verify top-level PDFs created
    utils::assert_pdf_created(&temp_output_dir.path().join("top_level1.pdf"));
    utils::assert_pdf_created(&temp_output_dir.path().join("top_level2.pdf"));

    // Nested file should NOT be processed
    assert!(
        !temp_output_dir.path().join("nested.pdf").exists(),
        "Should not process files in subdirectories"
    );
}

#[test]
fn test_batch_empty_directory() {
    // Test that running on empty directory handles gracefully
    let temp_empty_dir = TempDir::new().expect("Failed to create temp empty dir");
    let temp_output_dir = TempDir::new().expect("Failed to create temp output dir");

    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_output_dir.path())
        .arg(temp_empty_dir.path())
        .output()
        .expect("Failed to execute command");

    // Should succeed but process 0 files
    assert!(
        output.status.success(),
        "Empty directory processing should succeed"
    );

    // Verify no PDFs created
    utils::assert_pdf_count(temp_output_dir.path(), 0);

    let stdout = utils::bytes_to_str(&output.stdout);
    assert!(
        stdout.contains("Found 0 JSON files") || stdout.contains("Processed 0 files"),
        "Should report 0 files processed"
    );
}

// ============================================================================
// CLI Argument Tests
// ============================================================================

#[test]
fn test_output_directory_argument() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_dir.path())
        .arg(paths::SIMPLE_BOM_PATH)
        .output()
        .expect("Failed to execute command");

    assert!(output.status.success());

    let pdf_name = get_expected_pdf_name(paths::SIMPLE_BOM_PATH);
    let generated_pdf = temp_dir.path().join(&pdf_name);

    utils::assert_pdf_created(&generated_pdf);
}

#[test]
fn test_invalid_output_directory_fails() {
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg("/nonexistent/directory/that/does/not/exist")
        .arg(paths::SIMPLE_BOM_PATH)
        .output()
        .expect("Failed to execute command");

    // Command should fail
    assert!(!output.status.success());

    // Should have error message in stderr
    assert!(!output.stderr.is_empty());
}

#[test]
fn test_invalid_property_missing_value_returns_nonzero_exit() {
    // A CycloneDX file with a component property where the `name` field is
    // present but `value` is missing is spec non-compliant and must cause the
    // tool to exit with a non-zero status so calling scripts notice the
    // failure instead of silently succeeding. Regression seen with VDRs
    // exported from OWASP Dependency-Track, which strips empty-string property
    // values.
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_dir.path())
        .arg(paths::BOM_VDR_WITH_INVALID_PROPERTY)
        .output()
        .expect("Failed to execute command");

    assert!(
        !output.status.success(),
        "Expected non-zero exit on malformed BoM, got: {}\nstdout: {}\nstderr: {}",
        output.status,
        utils::bytes_to_str(&output.stdout),
        utils::bytes_to_str(&output.stderr),
    );

    let stderr = utils::bytes_to_str(&output.stderr);
    assert!(
        stderr.contains("missing field `value`"),
        "Expected per-file parse error in stderr, got: {stderr}"
    );
    assert!(
        stderr.contains("failed to process"),
        "Expected aggregate processing-failure message in stderr, got: {stderr}"
    );

    // No PDF should have been produced
    utils::assert_pdf_count(temp_dir.path(), 0);
}

#[test]
fn test_nonexistent_input_file_fails() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg(temp_dir.path())
        .arg("/nonexistent/file.json")
        .output()
        .expect("Failed to execute command");

    // Command should fail
    assert!(!output.status.success());
}

#[test]
fn test_json_with_analysis_renders_correctly() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let _ = run_vex2pdf(paths::BOM_VDR_WITH_ANALYSIS, temp_dir.path(), None);

    // Verify PDF was created
    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_ANALYSIS);
    let pdf_path = temp_dir.path().join(&pdf_name);
    assert!(
        pdf_path.exists(),
        "Expected PDF not found: {}",
        pdf_path.display()
    );

    // Verify PDF content with checksum
    utils::assert_pdf_checksum_matches(&pdf_path);
}

#[test]
fn test_xml_with_analysis_renders_correctly() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let _ = run_vex2pdf(paths::BOM_VDR_WITH_ANALYSIS_XML, temp_dir.path(), None);

    // Verify PDF was created
    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_ANALYSIS_XML);
    let pdf_path = temp_dir.path().join(&pdf_name);
    assert!(
        pdf_path.exists(),
        "Expected PDF not found: {}",
        pdf_path.display()
    );

    // Verify PDF content with checksum
    utils::assert_pdf_checksum_matches(&pdf_path);
}

#[test]
fn test_err_output() {
    // trigger error path
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("-d")
        .arg("/path/to/unknown")
        .output()
        .expect("failed to run executable");

    // verify error output
    let stderr_str = String::from_utf8_lossy(&output.stderr);
    assert!(stderr_str.contains("Problem setting up working environment"));
}

#[test]
fn test_license_output() {
    // trigger license output

    let output = Command::new(paths::PATH_TO_EXE)
        .arg("--license")
        .output()
        .expect("failed to run executable");

    // Verify content
    let stderr_str = String::from_utf8_lossy(&output.stdout);
    assert!(stderr_str.contains(
        "VEX2PDF is licensed under either MIT or Apache License, Version 2.0 at your option."
    ));
    assert!(stderr_str.contains("license text can be found under: https://gitlab.com/jurassicLizard/vex2pdf/-/blob/master/README.md#license"));
    assert!(stderr_str.contains("SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007"));
    assert!(stderr_str.contains("DEALINGS IN THE FONT SOFTWARE"));
}

#[test]
fn test_version_long_output() {
    // Test --version flag output
    let output = Command::new(paths::PATH_TO_EXE)
        .arg("--version")
        .output()
        .expect("failed to run executable");

    // Verify version output contains copyright info
    let stdout_str = String::from_utf8_lossy(&output.stdout);
    assert!(stdout_str.contains("vex2pdf"));
    assert!(stdout_str.contains("CycloneDX (VEX) to PDF Converter"));
    assert!(stdout_str.contains("Copyright (c) 2025 Salem B. - MIT Or Apache 2.0 License"));
}

#[test]
fn test_version_info_on_startup() {
    // Test that version info appears in logs when software runs normally
    let temp_dir = TempDir::new().expect("Failed to create temp dir");

    let output = Command::new(paths::PATH_TO_EXE)
        .current_dir(temp_dir.path())
        .output()
        .expect("failed to run executable");

    // Verify version info appears in stdout logs
    let stdout_str = String::from_utf8_lossy(&output.stdout);
    assert!(stdout_str.contains("vex2pdf"));
    assert!(stdout_str.contains("CycloneDX (VEX) to PDF Converter"));
    assert!(stdout_str.contains("Copyright (c) 2025 Salem B. - MIT Or Apache 2.0 License"));
}

#[test]
fn test_report_title_override_via_cli() {
    let temp_dir = TempDir::new().expect("Failed to create temporary directory");

    let _ = run_vex2pdf(
        paths::BOM_VDR_WITH_MANY_VULNS_TITLES_OVERRIDE,
        temp_dir.path(),
        Some(vec!["-t", "Title override", "-n", "Meta name override"]),
    );

    // Verify PDF was created
    let pdf_name = get_expected_pdf_name(paths::BOM_VDR_WITH_MANY_VULNS_TITLES_OVERRIDE);
    let pdf_path = temp_dir.path().join(&pdf_name);
    assert!(
        pdf_path.exists(),
        "Expected PDF not found: {}",
        pdf_path.display()
    );

    // Verify PDF content with checksum
    utils::assert_pdf_checksum_matches(&pdf_path);
}