From adc39a052319ac98fa259609b25f2408273d1468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 13 Oct 2024 18:02:16 +0200 Subject: [PATCH] Improve doc and only use doctest --- lib/haha_yes/utils.ex | 8 +++----- test/haha_yes_test.exs | 8 -------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/haha_yes/utils.ex b/lib/haha_yes/utils.ex index efd469d..358a0dc 100644 --- a/lib/haha_yes/utils.ex +++ b/lib/haha_yes/utils.ex @@ -10,14 +10,12 @@ defmodule HahaYes.Utility do ``` iex> HahaYes.Utility.download("https://x.com/i/status/1844841048603783249", "#{System.tmp_dir}/test") - - {:ok, /tmp}/test.mp4 + {:ok, "#{System.tmp_dir}/test.mp4"} ``` ``` - iex> HahaYes.Utility.download("invalid", "#{System.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"} + iex> HahaYes.Utility.download("http://example.com", "#{System.tmp_dir}/test") + {:error,"[generic] Extracting URL: http://example.com\\n[generic] example: Downloading webpage\\n[generic] example: Extracting information\\nERROR: Unsupported URL: http://example.com\\n"} ``` """ diff --git a/test/haha_yes_test.exs b/test/haha_yes_test.exs index 877d4b3..04609c5 100644 --- a/test/haha_yes_test.exs +++ b/test/haha_yes_test.exs @@ -1,12 +1,4 @@ defmodule HahaYesTest do use ExUnit.Case doctest HahaYes.Utility - - @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