Skip to content

Commit

Permalink
Added more tests (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecardleitao authored Jan 29, 2024
1 parent e6d4496 commit fa593c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[forbid(unsafe_code)]
mod aircraft_db;
mod aircraft_owners;
mod aircraft_types;
Expand Down
33 changes: 25 additions & 8 deletions tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ async fn ads_b_lost_on_ground() -> Result<(), Box<dyn Error>> {
Ok(())
}

#[tokio::test]
async fn fs_azure() -> Result<(), Box<dyn Error>> {
let client = flights::fs_azure::initialize_anonymous("privatejets", "data");

let _ = flights::positions("459cd3", date!(2020 - 01 - 01), Some(&client)).await?;
Ok(())
}

#[tokio::test]
async fn case_459257_2023_12_17() -> Result<(), Box<dyn Error>> {
let legs = legs(date!(2023 - 12 - 17), date!(2023 - 12 - 20), "459257", None).await?;
Expand Down Expand Up @@ -122,3 +114,28 @@ async fn case_45c824_2023_12_12() -> Result<(), Box<dyn Error>> {
assert!(legs[2].duration().as_seconds_f32() < day);
Ok(())
}

#[tokio::test]
async fn fs_azure() -> Result<(), Box<dyn Error>> {
let client = flights::fs_azure::initialize_anonymous("privatejets", "data");

let _ = flights::positions("459cd3", date!(2020 - 01 - 01), Some(&client)).await?;
Ok(())
}

#[tokio::test]
async fn airports() -> Result<(), Box<dyn Error>> {
let airports = flights::airports_cached().await?;

let airport = flights::closest((57.094, 9.854), &airports);
assert_eq!(airport.name, "Aalborg Airport");
Ok(())
}

#[tokio::test]
async fn loads() -> Result<(), Box<dyn Error>> {
let _ = flights::load_aircraft_owners()?;
let _ = flights::load_private_jet_types()?;
let _ = flights::load_owners()?;
Ok(())
}

0 comments on commit fa593c9

Please sign in to comment.