postjevsql.git / tests / gate_unsure_band.rs

Release gate "unsure band", replayed: the repeated question's recorded live answer (tests/fixtures/unsure_band.json, from tools/record-gates --send, which sends the repeats' one distinct request once). The extension must still send exactly those bytes.

6use support::gates::{QUESTION, fixture, setup_people};
7use support::mock_jev::MockJev;
8use support::mock_jev::replay::Replay;
10#[tokio::test(flavor = "multi_thread")]
11async fn asks_the_recorded_question() {
12    let replay = Replay::new(&fixture("unsure_band"));
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 p: f64 = client
18        .query_one("SELECT jev_prob(p, $1) FROM people p WHERE name = 'Ana'", &[&QUESTION])
19        .await
20        .expect("replayed")
21        .get(0);
22    assert_eq!(p, 0.88);
23    assert_eq!(mock.requests().len(), 1);
24    replay.assert_complete();
25}