Crates.io | expect-json |
lib.rs | expect-json |
version | |
source | src |
created_at | 2025-03-29 16:00:01.986192+00 |
updated_at | 2025-04-13 22:18:34.868115+00 |
description | For testing |
homepage | |
repository | https://github.com/JosephLenton/expect-json |
max_upload_size | |
id | 1611417 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is still a work in progress. Come back later when more is done!
Declare your expectations in your Json:
use expect_json::expect;
server
.post(&"/user")
.await
.assert_json(&json!({
"name": "Joe",
"age": expect.in_range(20..=30),
"timestamp": expect.iso_date_time(),
"ids": expect.contains(&[1, 2, 3, 4]),
"comments": [
{
"timestamp": expect.iso_date_time().greater_than("2025-01-01"),
"content": "Hello!"
}
]
}));
expect.contains("a string")
expect.contains([1, "2", 3.3, true, false, {}])