use gqls::load;
use gqls::model::Kind;
const ENDPOINT: &str = "https://countries.trevorblades.com/";
#[test]
#[ignore = "hits the network; run with --ignored"]
fn introspects_and_searches_a_live_endpoint() {
let records = load::load(ENDPOINT).expect("HTTP introspection should succeed");
assert!(!records.is_empty(), "expected a non-empty schema");
assert!(
records
.iter()
.any(|r| r.kind == Kind::Object && r.name == "Country"),
"expected a Country object type"
);
assert!(
records.iter().any(|r| r.path == "Query.country"),
"expected a Query.country root field"
);
let hits = gqls::search::search("contry", &records, None, 5);
assert!(
hits.iter().any(|h| h.record.name == "Country"),
"fuzzy search should surface Country despite the typo"
);
}