Skip to main content

assert_json_truthy

Function assert_json_truthy 

Source
pub fn assert_json_truthy(value: &Value, pointer: &str)
Expand description

Assert that a JSON value at the given pointer is truthy (not null/false/0/“”).

§Panics

Panics if the value at pointer is missing, null, false, zero, or empty.

§Examples

use serde_json::json;

let value = json!({"active": true, "name": "test", "count": 42});
victauri_test::assert_json_truthy(&value, "/active");
victauri_test::assert_json_truthy(&value, "/name");
victauri_test::assert_json_truthy(&value, "/count");