Skip to content

Commit

Permalink
fix: Mix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed Oct 14, 2024
1 parent 0ca470d commit d4e5bb7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions elixir-api/test/api/post_posts_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ defmodule PostPostsTest do
)
|> Mox.expect(
:post,
# title, desc, and body
3,
# title + desc
2,
fn url, body, _params ->
assert String.contains?(url, "https://translation.googleapis.com/")

Expand Down
2 changes: 2 additions & 0 deletions elixir-api/test/support/fixtures.exs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ defmodule TestFixtures do
"title" => "About me"
}
],
"bio" =>
"Hey, I'm Maxim! I build stuff for the web. This is a fake fixture bio, but it's still pretty cool.",
"meta" => [
%{
"_key" => "718d6c28e1ed",
Expand Down
11 changes: 9 additions & 2 deletions elixir-api/test/translate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,20 @@ defmodule TranslateTest do
|> Map.get("text") == stub_translated_text

assert is_map(translated_posts)
# Posts should have their body translated

# Posts should not have their body translated
assert translated_posts["result"]
|> List.first()
|> Map.get("body")
|> List.first()
|> Map.get("children")
|> List.first()
|> Map.get("text") == stub_translated_text
|> Map.get("text") ==
stub_post["result"]
|> Map.get("body")
|> List.first()
|> Map.get("children")
|> List.first()
|> Map.get("text")
end
end

0 comments on commit d4e5bb7

Please sign in to comment.