Skip to content

Commit

Permalink
Modified us-street test for new format field, Updated us-extract test…
Browse files Browse the repository at this point in the history
… to use lookup method
  • Loading branch information
andrewjohnsonsmarty committed Oct 24, 2023
1 parent 5e6a4e1 commit 786fa14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions smarty-rust-sdk/src/us_extract_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ mod tests {
..Default::default()
};

assert_eq!(
serde_json::to_string_pretty(&lookup).unwrap(),
"{\n \"text\": \"Meet me at 3214 N University Ave Provo UT 84604 just after 3pm.\",\n \"html\": \"\",\n \"aggressive\": true,\n \"addr_line_breaks\": false,\n \"addr_per_line\": 1,\n \"match\": \"strict\"\n}"
);
let expected_result = vec![
("aggressive".to_string(), "true".to_string()),
("addr_per_line".to_string(), "1".to_string()),
("match".to_string(), "strict".to_string()),
];

assert_eq!(lookup.into_param_array(), expected_result);
}
}
1 change: 1 addition & 0 deletions smarty-rust-sdk/src/us_street_api/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl Lookup {
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum MatchStrategy {
#[default]
Strict,
Expand Down
2 changes: 2 additions & 0 deletions smarty-rust-sdk/src/us_street_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mod tests {
("lastline".to_string(), "Mountain View, CA".to_string()),
("candidates".to_string(), 5.to_string()),
("match".to_string(), "enhanced".to_string()),
("format".to_string(), "default".to_string()),
];

assert_eq!(lookup.into_param_array(), expected_result);
Expand All @@ -62,6 +63,7 @@ mod tests {
("lastline".to_string(), "Mountain View, CA".to_string()),
("candidates".to_string(), 5.to_string()),
("match".to_string(), "enhanced".to_string()),
("format".to_string(), "default".to_string()),
];

let mut batch = Batch::default();
Expand Down

0 comments on commit 786fa14

Please sign in to comment.