Skip to content

Commit

Permalink
Add assertions to integration tests to verify file and directory cont…
Browse files Browse the repository at this point in the history
…ents

* **test_mixed_files_and_directories**
  - Add assertions to check the content of the output and the number of files included
* **test_nonexistent_paths**
  - Add assertions to check the content of the output and the number of files included
* **test_empty_input_defaults_to_cwd**
  - Add assertions to check the content of the output and the number of files included
  - Restore the original directory after the test
  • Loading branch information
mohsen1 committed Feb 22, 2025
1 parent a1a5ae8 commit e040139
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ mod integration_tests {

let result = serialize_repo(&config);
assert!(result.is_ok());
// Further assertions could be added here to check the content of the output,
// but that would depend on the specific output format and template.
let (output, files) = result.unwrap();
assert!(output.contains("file1 content"));
assert!(output.contains("file2 content"));
assert!(output.contains("nested content"));
assert_eq!(files.len(), 3);
}

#[test]
Expand Down Expand Up @@ -91,6 +94,11 @@ mod integration_tests {
// Should not panic, even with non-existent paths
let result = serialize_repo(&config);
assert!(result.is_ok());
let (output, files) = result.unwrap();
assert!(output.contains("file1 content"));
assert!(output.contains("file2 content"));
assert!(output.contains("nested content"));
assert_eq!(files.len(), 3);
}

#[test]
Expand All @@ -115,9 +123,12 @@ mod integration_tests {

let result = serialize_repo(&config);
assert!(result.is_ok());
// You could add an assertion here to check if the output contains
// the content of "current_dir_file.txt", but it depends on your
// output format.
let (output, files) = result.unwrap();
assert!(output.contains("current dir file content"));
assert_eq!(files.len(), 1);

// Restore the original directory
std::env::set_current_dir(original_dir).unwrap();
}

#[test]
Expand Down

0 comments on commit e040139

Please sign in to comment.