anvil_test/lib.rs
1//! Anvilforge test utilities — Pest-flavored HTTP and fluent expectations.
2//!
3//! Import the prelude in your test files:
4//!
5//! ```ignore
6//! use anvilforge::assay::*;
7//!
8//! #[tokio::test]
9//! async fn root_returns_welcome() {
10//! let client = TestClient::new(bootstrap::app::build().await.unwrap()).await;
11//!
12//! client.get("/").await
13//! .assert_ok()
14//! .assert_see("Welcome");
15//!
16//! expect(2 + 2).to_be(4);
17//! expect("hello world").to_contain("world");
18//! expect(vec![1, 2, 3]).to_have_length(3);
19//! }
20//! ```
21
22pub mod client;
23pub mod datasets;
24pub mod expect;
25pub mod factory;
26
27#[cfg(feature = "browser")]
28pub mod browser;
29
30pub use client::{TestClient, TestResponse};
31pub use expect::{expect, Expect, Not};
32pub use factory::Factory;
33
34// Re-exported for the `dataset!` macro's name-concatenation. Keeps user
35// crates from needing to add `paste` as a direct dependency.
36pub use paste;
37
38/// The Pest-style prelude. `use anvilforge::assay::*;` or
39/// `use anvil_test::assay::*;` to bring in the testing surface.
40pub mod assay {
41 pub use crate::{dataset, dataset_async};
42 pub use crate::{expect, Expect, Factory, Not, TestClient, TestResponse};
43 pub use serde_json::json;
44
45 #[cfg(feature = "browser")]
46 pub use crate::browser::{Browser, Page};
47}