Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update assert-json-diff version. #108

Merged
merged 1 commit into from
Feb 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ pub const SERVER_URL: &str = "http://127.0.0.1:1234";

pub use crate::server::address as server_address;
pub use crate::server::url as server_url;
use assert_json_diff::{assert_json_no_panic, Actual, Comparison, Expected};
use assert_json_diff::{assert_json_no_panic, Mode};

///
/// Initializes a mock for the provided `method` and `path`.
Expand Down Expand Up @@ -674,17 +674,14 @@ impl Matcher {
value == other
}
Matcher::PartialJson(ref json_obj) => {
let other: serde_json::Value = serde_json::from_str(other).unwrap();
let actual = Actual::new(other);
let expected = Expected::new(json_obj.clone());
assert_json_no_panic(Comparison::Include(actual, expected)).is_ok()
let actual: serde_json::Value = serde_json::from_str(other).unwrap();
let expected = json_obj.clone();
assert_json_no_panic(actual, expected, Mode::Lenient).is_ok()
}
Matcher::PartialJsonString(ref value) => {
let value: serde_json::Value = serde_json::from_str(value).unwrap();
let other: serde_json::Value = serde_json::from_str(other).unwrap();
let actual = Actual::new(other);
let expected = Expected::new(value);
assert_json_no_panic(Comparison::Include(actual, expected)).is_ok()
let expected: serde_json::Value = serde_json::from_str(value).unwrap();
let actual: serde_json::Value = serde_json::from_str(other).unwrap();
assert_json_no_panic(actual, expected, Mode::Lenient).is_ok()
}
Matcher::UrlEncoded(ref expected_field, ref expected_value) => other
.split('&')
Expand Down