Crates.io | expect-json-macros |
lib.rs | expect-json-macros |
version | 1.5.0 |
created_at | 2025-04-24 23:09:07.443572+00 |
updated_at | 2025-08-26 22:56:33.153419+00 |
description | Macros for Expect Json |
homepage | |
repository | https://github.com/JosephLenton/expect-json |
max_upload_size | |
id | 1648375 |
size | 9,971 |
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, {}])