From d4e5bb718664cef937eb7953fffc3e5f9735c2df Mon Sep 17 00:00:00 2001 From: kiosion Date: Mon, 14 Oct 2024 01:35:40 -0400 Subject: [PATCH] fix: Mix tests --- elixir-api/test/api/post_posts_test.exs | 4 ++-- elixir-api/test/support/fixtures.exs | 2 ++ elixir-api/test/translate_test.exs | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/elixir-api/test/api/post_posts_test.exs b/elixir-api/test/api/post_posts_test.exs index 12a184d88..ff14a5054 100644 --- a/elixir-api/test/api/post_posts_test.exs +++ b/elixir-api/test/api/post_posts_test.exs @@ -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/") diff --git a/elixir-api/test/support/fixtures.exs b/elixir-api/test/support/fixtures.exs index 73c04e11f..b768cf03e 100644 --- a/elixir-api/test/support/fixtures.exs +++ b/elixir-api/test/support/fixtures.exs @@ -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", diff --git a/elixir-api/test/translate_test.exs b/elixir-api/test/translate_test.exs index e95d90da1..c8336f9de 100644 --- a/elixir-api/test/translate_test.exs +++ b/elixir-api/test/translate_test.exs @@ -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