pata 0.0.1

A fast, lightweight, and evidence-driven email validation library for Rust
Documentation
//! Batch validation contract tests.

use futures_executor::block_on;
use futures_util::{StreamExt as _, stream};
use pata::{Validator, Verdict};

#[test]
fn batch_preserves_input_order_and_individual_reports() {
    let validator = Validator::local();
    let input = stream::iter([
        "first@example.com".to_owned(),
        "malformed".to_owned(),
        "third@example.com".to_owned(),
    ]);

    let reports = block_on(validator.validate_all(input).collect::<Vec<_>>());

    assert_eq!(reports[0].input(), "first@example.com");
    assert_eq!(reports[1].verdict(), Verdict::Invalid);
    assert_eq!(reports[2].input(), "third@example.com");
}