Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change component name to lowercase #203

Merged
merged 2 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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