Skip to content

Commit

Permalink
twiq: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Aug 10, 2022
1 parent b919583 commit 11afbdb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions twiq/crates/twitter_user_id/src/main.rs
Expand Up @@ -35,3 +35,19 @@ async fn main() -> anyhow::Result<()> {
println!("{}", serde_json::to_string(&json)?);
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
async fn test() -> anyhow::Result<()> {
let bearer_token = env::var("TWITTER_BEARER_TOKEN")?;
let username = "bouzuya";
let json = get_user(bearer_token.as_str(), username).await?;
assert_eq!(json.data.id, "125962981");
assert_eq!(json.data.name, "bouzuya");
assert_eq!(json.data.username, "bouzuya");
Ok(())
}
}

0 comments on commit 11afbdb

Please sign in to comment.