- Implement core Rust backend with FFmpeg integration - Add TheTVDB API client with token caching - Implement directory scanner with progress callbacks - Create file manager with rename and move operations - Add audit logging functionality - Implement file mapping for TV episode renaming - Build Node.js native addon via NAPI - Include comprehensive unit and integration tests - Update gitignore to exclude build artifacts and temp files Resolves #TBD
35 lines
1.0 KiB
Rust
35 lines
1.0 KiB
Rust
// Unit tests for utility functions
|
|
|
|
use movie_mapper::utils::error::MovieMapperError;
|
|
use movie_mapper::utils::{Result, ScannerError};
|
|
|
|
#[test]
|
|
fn test_error_types() {
|
|
// Test that error types can be created
|
|
let _error: Result<()> = Err(MovieMapperError::Scanner(ScannerError::NotFound(
|
|
"/test/path".to_string(),
|
|
)));
|
|
|
|
// Test error formatting
|
|
let error = ScannerError::NotFound("/test/path".to_string());
|
|
assert!(error.to_string().contains("/test/path"));
|
|
}
|
|
|
|
#[test]
|
|
fn test_result_type_alias() {
|
|
// Test that Result type alias works
|
|
let result: Result<String> = Ok("test".to_string());
|
|
assert!(result.is_ok());
|
|
}
|
|
|
|
#[test]
|
|
fn test_scanner_error_format() {
|
|
let error = ScannerError::NotFound("/home/test".to_string());
|
|
let error_str = error.to_string();
|
|
|
|
// The error message should contain the path
|
|
assert!(error_str.contains("/home/test"));
|
|
// The error message should indicate it's a directory error
|
|
assert!(error_str.contains("Directory not found"));
|
|
}
|