mod client;
mod segment;
#[cfg(feature = "image")]
mod html_template;
pub use client::{ShindanClient, ShindanDomain, ShindanTextResult};
pub use segment::{Segment, filter_segments_by_type};
#[cfg(feature = "image")]
pub use client::ShindanImageResult;
#[cfg(test)]
mod tests {
use tokio;
use super::client::{ShindanClient, ShindanDomain};
#[tokio::test]
async fn test_get_title() -> Result<(), Box<dyn std::error::Error>> {
let client = ShindanClient::new(ShindanDomain::En)?;
let result = client.get_title("1221154").await?;
assert_eq!("What kind of a person will you turn out to be?", result);
Ok(())
}
#[tokio::test]
async fn test_get_text_result() -> Result<(), Box<dyn std::error::Error>> {
let client = ShindanClient::new(ShindanDomain::En)?;
let result = client.get_text_result("1221154", "test_user").await?;
assert_eq!("What kind of a person will you turn out to be?", result.title);
Ok(())
}
#[cfg(feature = "image")]
#[tokio::test]
async fn test_get_image_result()-> Result<(), Box<dyn std::error::Error>> {
let client = ShindanClient::new(ShindanDomain::En)?.init_browser()?;
let result = client.get_image_result("1221154", "test_user").await?;
assert_eq!("What kind of a person will you turn out to be?", result.title);
Ok(())
}
}