fix: use proper path, specify all models, place test in models.rs

This commit is contained in:
Ryan Walters
2025-08-20 08:43:01 -05:00
parent 730add4a79
commit ca82456a53
3 changed files with 14 additions and 19 deletions

View File

@@ -43,5 +43,3 @@ pub fn extract_streams(info: &ffprobe::FfProbe) -> Vec<StreamDetail> {
streams
}

View File

@@ -96,16 +96,3 @@ pub fn run() {
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[cfg(test)]
mod tests {
use ts_rs::TS;
#[test]
fn export_bindings() {
// This will generate TypeScript bindings when you run `cargo test export_bindings`
use crate::models::*;
StreamDetail::export_all_to("../../src/bindings").expect("Failed to export bindings");
}
}

View File

@@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
use ts_rs::TS;
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
#[ts(export)]
pub enum MediaType {
Audio,
Video,
@@ -15,7 +14,6 @@ pub enum MediaType {
}
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
#[ts(export)]
pub struct StreamResult {
pub path: String,
pub filename: String,
@@ -26,7 +24,6 @@ pub struct StreamResult {
}
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
#[ts(export)]
pub enum StreamDetail {
Video {
codec: String,
@@ -48,9 +45,22 @@ pub enum StreamDetail {
}
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
#[ts(export)]
pub struct StreamResultError {
pub filename: Option<String>,
pub reason: String,
pub error_type: String,
}
#[cfg(test)]
mod tests {
#[test]
fn export_bindings() {
// This will generate TypeScript bindings when you run `cargo test export_bindings`
use super::*;
StreamDetail::export_all_to("../src/bindings").expect("Failed to export bindings");
StreamResult::export_all_to("../src/bindings").expect("Failed to export bindings");
StreamResultError::export_all_to("../src/bindings").expect("Failed to export bindings");
MediaType::export_all_to("../src/bindings").expect("Failed to export bindings");
}
}