use stock_rust::{StockApi, Stocks};
#[tokio::test]
#[ignore = "requires network and upstream service stability"]
async fn live_netease_get_stock() {
let api = Stocks::new().expect("stocks client");
let stock = api
.netease
.get_stock("SH510500")
.await
.expect("netease get_stock");
assert_eq!(stock.code, "SH510500");
assert!(!stock.name.trim().is_empty());
}
#[tokio::test]
#[ignore = "requires network and upstream service stability"]
async fn live_tencent_get_stocks() {
let api = Stocks::new().expect("stocks client");
let list = api
.tencent
.get_stocks(&["SH510500".to_string(), "SZ000001".to_string()])
.await
.expect("tencent get_stocks");
assert_eq!(list.len(), 2);
assert_eq!(list[0].code, "SH510500");
assert_eq!(list[1].code, "SZ000001");
}
#[tokio::test]
#[ignore = "requires network and upstream service stability"]
async fn live_sina_search() {
let api = Stocks::new().expect("stocks client");
let list = api.sina.search_stocks("510500").await.expect("sina search");
assert!(!list.is_empty());
}
#[tokio::test]
#[ignore = "requires network and upstream service stability"]
async fn live_xueqiu_search() {
let api = Stocks::new().expect("stocks client");
let list = api
.xueqiu
.search_stocks("腾讯")
.await
.expect("xueqiu search");
assert!(!list.is_empty());
}