use super::WsChannel;
use std::collections::HashSet;
#[test]
fn every_channel_round_trips_and_names_are_unique() {
let mut names = HashSet::new();
for channel in WsChannel::ALL {
assert_eq!(WsChannel::parse(channel.as_str()), Some(channel));
assert!(names.insert(channel.as_str()), "{channel} listed twice");
}
}
#[test]
fn the_batched_indicative_channel_name_is_stable() {
assert_eq!(
WsChannel::IndicativeMarketDataV2.as_str(),
"indicative_market_data_v2"
);
}
#[cfg(feature = "rfq-v2")]
#[test]
fn the_private_rfq_v2_channel_is_subscribable() {
assert_eq!(WsChannel::parse("rfq_v2"), Some(WsChannel::RfqV2));
}
#[cfg(not(feature = "rfq-v2"))]
#[test]
fn the_rfq_v2_channel_needs_the_preview_feature() {
assert_eq!(WsChannel::parse("rfq_v2"), None);
}
#[test]
fn unknown_or_differently_cased_names_do_not_parse() {
for name in [
"",
"orders",
"candles:BTC:1m",
"Orderbook",
"competition",
"indicative_market_data_v3",
] {
assert_eq!(WsChannel::parse(name), None, "{name:?}");
}
}