Skip to content

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
henryboisdequin committed Jan 24, 2021
1 parent 49daa28 commit fbdc30e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,7 @@
"Financials",
"Finnhub",
"Forex",
"TSLA",
"compiletest",
"datetime",
"deps",
Expand Down
51 changes: 50 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 8,7 @@ mod utils;

#[cfg(test)]
mod test {
// `cargo t -- --nocapture` to test
use super::client::*;
use super::utils::*;

Expand All @@ -23,6 24,54 @@ mod test {
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client.symbol_lookup("AAPL".to_string()).await.unwrap();
println!("{:?}", res);
println!("{:#?}", res);
}

#[tokio::test]
async fn stock_symbol_test() {
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client.stock_symbol("US".to_string()).await.unwrap();
println!("{:#?}", res);
}

#[tokio::test]
async fn company_profile2_test() {
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client.company_profile2("TSLA".to_string()).await.unwrap();
println!("{:#?}", res);
}

#[tokio::test]
async fn market_news_test() {
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client.market_news("business".to_string()).await.unwrap();
println!("{:#?}", res);
}

#[tokio::test]
async fn company_news_test() {
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client
.company_news(
"GOOGL".to_string(),
"2020-12-10".to_string(),
"2021-01-10".to_string(),
)
.await
.unwrap();
println!("{:#?}", res);
}

#[tokio::test]
async fn news_sentiment_test() {
// TODO: error
let test_api_key = get_test_api_key();
let client = Client::new(test_api_key);
let res = client.news_sentiment("FB".to_string()).await.unwrap();
println!("{:#?}", res);
}
}

0 comments on commit fbdc30e

Please sign in to comment.