Rename
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
066ec8fe95
commit
2b739faa7e
10 changed files with 34 additions and 31 deletions
29
test/pleroma/language/translation_test.ex
Normal file
29
test/pleroma/language/translation_test.ex
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
defmodule Pleroma.Language.TranslationTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
alias Pleroma.Language.Translation
|
||||
# use Oban.Testing, repo: Pleroma.Repo
|
||||
|
||||
setup do: clear_config([Pleroma.Language.Translation, :provider], TranslationMock)
|
||||
|
||||
test "it translates text" do
|
||||
assert {:ok,
|
||||
%{
|
||||
content: "txet emos",
|
||||
detected_source_language: _,
|
||||
provider: _
|
||||
}} = Translation.translate("some text", "en", "uk")
|
||||
end
|
||||
|
||||
test "it stores translation result in cache" do
|
||||
Translation.translate("some text", "en", "uk")
|
||||
|
||||
assert {:ok, result} =
|
||||
Cachex.get(
|
||||
:translations_cache,
|
||||
"en/uk/#{:crypto.hash(:sha256, "some text") |> Base.encode64()}"
|
||||
)
|
||||
|
||||
assert result.content == "txet emos"
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue