fix: use mercxry translations api
This commit is contained in:
14
tests/app.rs
14
tests/app.rs
@@ -79,8 +79,8 @@ async fn translated_endpoint_returns_translated_description() {
|
||||
let translations = MockServer::start().await;
|
||||
mount_species(&pokeapi, "pikachu", false, "forest", "Electric cheeks.").await;
|
||||
Mock::given(matchers::method("POST"))
|
||||
.and(matchers::path("/translate/shakespeare.json"))
|
||||
.and(matchers::body_string_contains("Electric+cheeks"))
|
||||
.and(matchers::path("/translate/shakespeare"))
|
||||
.and(matchers::body_string_contains("Electric cheeks"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
|
||||
"contents": { "translated": "Electric cheeks, prithee." }
|
||||
})))
|
||||
@@ -112,8 +112,8 @@ async fn translated_endpoint_uses_yoda_for_legendary_pokemon() {
|
||||
let translations = MockServer::start().await;
|
||||
mount_species(&pokeapi, "mewtwo", true, "rare", "Created by science.").await;
|
||||
Mock::given(matchers::method("POST"))
|
||||
.and(matchers::path("/translate/yoda.json"))
|
||||
.and(matchers::body_string_contains("Created+by+science"))
|
||||
.and(matchers::path("/translate/yoda"))
|
||||
.and(matchers::body_string_contains("Created by science"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
|
||||
"contents": { "translated": "Created by science, it was." }
|
||||
})))
|
||||
@@ -121,7 +121,7 @@ async fn translated_endpoint_uses_yoda_for_legendary_pokemon() {
|
||||
.mount(&translations)
|
||||
.await;
|
||||
Mock::given(matchers::method("POST"))
|
||||
.and(matchers::path("/translate/shakespeare.json"))
|
||||
.and(matchers::path("/translate/shakespeare"))
|
||||
.respond_with(ResponseTemplate::new(200))
|
||||
.expect(0)
|
||||
.mount(&translations)
|
||||
@@ -151,7 +151,7 @@ async fn translated_endpoint_falls_back_to_original_description_when_translation
|
||||
let translations = MockServer::start().await;
|
||||
mount_species(&pokeapi, "zubat", false, "cave", "It has no eyes.").await;
|
||||
Mock::given(matchers::method("POST"))
|
||||
.and(matchers::path("/translate/yoda.json"))
|
||||
.and(matchers::path("/translate/yoda"))
|
||||
.respond_with(ResponseTemplate::new(500))
|
||||
.mount(&translations)
|
||||
.await;
|
||||
@@ -180,7 +180,7 @@ async fn translated_endpoint_falls_back_when_translation_is_empty() {
|
||||
let translations = MockServer::start().await;
|
||||
mount_species(&pokeapi, "zubat", false, "cave", "It has no eyes.").await;
|
||||
Mock::given(matchers::method("POST"))
|
||||
.and(matchers::path("/translate/yoda.json"))
|
||||
.and(matchers::path("/translate/yoda"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({
|
||||
"contents": { "translated": " " }
|
||||
})))
|
||||
|
||||
Reference in New Issue
Block a user