diff options
| author | Max Audron <audron@cocaine.farm> | 2025-05-06 16:17:35 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-05-06 16:19:30 +0200 |
| commit | b6350162b4c70abb896613e4ebea65ca1661450d (patch) | |
| tree | 2e55e0477b4d2f7a646a97f92ee1362db769f75e /src/hooks/wolfram_alpha.rs | |
| parent | add nix build and module (diff) | |
update dependencies
Diffstat (limited to 'src/hooks/wolfram_alpha.rs')
| -rw-r--r-- | src/hooks/wolfram_alpha.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/hooks/wolfram_alpha.rs b/src/hooks/wolfram_alpha.rs index 9f56df4..d0ab81e 100644 --- a/src/hooks/wolfram_alpha.rs +++ b/src/hooks/wolfram_alpha.rs @@ -180,7 +180,7 @@ mod tests { use crate::hooks::wolfram_alpha::clean_result_text; - use super::{get_input_query, get_wa_user_short_url, wa_query}; + use super::{get_input_query, wa_query}; use anyhow::{Error, Result}; use mockito::{self, Matcher}; @@ -273,13 +273,17 @@ mod tests { #[tokio::test] async fn test_query_with_result_with_wrong_json_parsing() -> Result<(), Error> { let body = include_str!("../../tests/resources/wolfram_alpha_api_response_wrong_json.json"); - let _m = mockito::mock("GET", Matcher::Any) + + let mut server = mockito::Server::new_async().await; + + let _m = server + .mock("GET", Matcher::Any) // Trimmed down version of a full WA response: .with_body(body) - .create(); - mockito::start(); + .create_async() + .await; - let res = wa_query("what is a url", None, Some(&mockito::server_url())).await?; + let res = wa_query("what is a url", None, Some(&server.url())).await?; assert_eq!(res, "No results."); Ok(()) } |
