Test download util

This commit is contained in:
Loïc Bersier 2024-10-13 17:42:02 +02:00
parent 4c8d48c575
commit ef6828531b

View file

@ -1,8 +1,12 @@
defmodule HahaYesTest do
use ExUnit.Case
doctest HahaYes
doctest HahaYes.Utility
test "greets the world" do
assert HahaYes.hello() == :world
@tag :tmp_dir
test "download utils", %{tmp_dir: tmp_dir} do
assert HahaYes.Utility.download("https://x.com/i/status/1844841048603783249", "#{tmp_dir}/test") == {:ok, "#{tmp_dir}/test.mp4"}
assert HahaYes.Utility.download("invalid", "#{tmp_dir}/test") == {:error, "[generic] Extracting URL: invalid\nERROR: [generic] 'invalid' is not a valid URL. Set --default-search \"ytsearch\" (or run yt-dlp \"ytsearch:invalid\" ) to search YouTube\n"}
end
end