|
| 1 | +#[cfg(test)] |
| 2 | +mod tests { |
| 3 | + use super::*; |
| 4 | + use tauri::AppHandle; |
| 5 | + use std::path::PathBuf; |
| 6 | + |
| 7 | + #[tokio::test] |
| 8 | + async fn test_start_recording() { |
| 9 | + let app = AppHandle::default(); |
| 10 | + let state = MutableState::default(); |
| 11 | + let result = start_recording(app, state).await; |
| 12 | + assert!(result.is_ok()); |
| 13 | + } |
| 14 | + |
| 15 | + #[tokio::test] |
| 16 | + async fn test_stop_recording() { |
| 17 | + let app = AppHandle::default(); |
| 18 | + let state = MutableState::default(); |
| 19 | + let result = stop_recording(app, state).await; |
| 20 | + assert!(result.is_ok()); |
| 21 | + } |
| 22 | + |
| 23 | + #[tokio::test] |
| 24 | + async fn test_copy_file_to_path() { |
| 25 | + let app = AppHandle::default(); |
| 26 | + let src = "test_src.txt".to_string(); |
| 27 | + let dst = "test_dst.txt".to_string(); |
| 28 | + let result = copy_file_to_path(app, src, dst).await; |
| 29 | + assert!(result.is_ok()); |
| 30 | + } |
| 31 | + |
| 32 | + #[tokio::test] |
| 33 | + async fn test_copy_screenshot_to_clipboard() { |
| 34 | + let app = AppHandle::default(); |
| 35 | + let path = PathBuf::from("test_screenshot.png"); |
| 36 | + let result = copy_screenshot_to_clipboard(app, path).await; |
| 37 | + assert!(result.is_ok()); |
| 38 | + } |
| 39 | + |
| 40 | + #[tokio::test] |
| 41 | + async fn test_export_video() { |
| 42 | + let app = AppHandle::default(); |
| 43 | + let video_id = "test_video_id".to_string(); |
| 44 | + let project = ProjectConfiguration::default(); |
| 45 | + let progress = tauri::ipc::Channel::new(|_| Ok(())); |
| 46 | + let result = export_video(app, video_id, project, progress, true).await; |
| 47 | + assert!(result.is_ok()); |
| 48 | + } |
| 49 | +} |
0 commit comments