Skip to content

Instantly share code, notes, and snippets.

@simanacci
Created February 26, 2024 12:20
Show Gist options
  • Save simanacci/f9ae188c44d4e5bd822177e458bd27bb to your computer and use it in GitHub Desktop.
Save simanacci/f9ae188c44d4e5bd822177e458bd27bb to your computer and use it in GitHub Desktop.
#[actix_web::test]
async fn units() -> anyhow::Result<()> {
std::env::set_var("RUST_LOG", "info");
std::env::set_var("RUST_BACKTRACE", "1");
dotenv::dotenv().ok();
let ctx = TestContext::new();
let meter = general::M1;
let gadget = fixtures::gadget(&ctx.client, meter, Uuid::new_v4()).await?;
let message =
fixtures::message(&ctx.client, CLASSIC, Some(gadget.uuid), Uuid::new_v4()).await?;
let res = Message::units(&message.sms)?;
// Test
assert!(res.is_some());
assert_eq!(res.unwrap(), general::U1);
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment