1//! Release gate "ranking", replayed: `ORDER BY jev_prob … LIMIT` over the 2//! recorded live answers (`tests/fixtures/ranking.json`, from 3//! `tools/record-gates --send`). A change to the requests the extension 4//! sends fails here, naming the request, without reaching any network. 5 6use support::gates::{QUESTION, RANKING_SQL, fixture, setup_people}; 7use support::mock_jev::MockJev; 8use support::mock_jev::replay::Replay; 9 10#[tokio::test(flavor = "multi_thread")] 11async fn ranks_by_the_recorded_answers() { 12 let replay = Replay::new(&fixture("ranking")); 13 let mock = MockJev::start(replay.responder()).await; 14 let (_pg, client) = support::jev_instance(&mock).await; 15 setup_people(&client).await.expect("setup"); 16 17 let top: String = client.query_one(RANKING_SQL, &[&QUESTION]).await.expect("replayed").get(0); 18 assert_eq!(top, "Ana"); 19 let p: f64 = client 20 .query_one("SELECT jev_prob(p, $1) FROM people p WHERE name = 'Rui'", &[&QUESTION]) 21 .await 22 .expect("served from the cache") 23 .get(0); 24 assert_eq!(p, 0.28); 25 replay.assert_complete(); 26}