Skip to content

Commit

Permalink
Change component name to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
nappex authored Nov 4, 2023
2 parents 59a6535 + 643c10c commit 4702701
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cli.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Onigumo.CLI do
@components %{
:Downloader => Onigumo.Downloader
:downloader => Onigumo.Downloader
}

def main(argv) do
Expand Down
15 changes: 11 additions & 4 deletions test/onigumo_cli_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ defmodule OnigumoCLITest do
"http://onigumo.local/bye.html"
]

@invalid_arguments [
"Downloader",
"uploader"
]

describe("Onigumo.CLI.main/1") do
@tag :tmp_dir
test("run CLI with 'Downloader' argument", %{tmp_dir: tmp_dir}) do
test("run CLI with 'downloader' argument", %{tmp_dir: tmp_dir}) do
expect(HTTPoisonMock, :start, fn -> nil end)
expect(HTTPoisonMock, :get!, length(@urls), &HttpSupport.response/1)

Expand All @@ -18,11 +23,13 @@ defmodule OnigumoCLITest do
input_file_content = InputSupport.url_list(@urls)
File.write!(input_path_tmp, input_file_content)
File.cd(tmp_dir)
Onigumo.CLI.main(["Downloader"])
Onigumo.CLI.main(["downloader"])
end

test("run CLI with invalid argument") do
assert_raise(MatchError, fn -> Onigumo.CLI.main(["Uploader"]) end)
for argument <- @invalid_arguments do
test("run CLI with invalid argument #{inspect(argument)}") do
assert_raise(MatchError, fn -> Onigumo.CLI.main([unquote(argument)]) end)
end
end

test("run CLI with no arguments") do
Expand Down

0 comments on commit 4702701

Please sign in to comment.