Skip to content

Commit 5edfaae

Browse files
committed
Refactor e2e_test.exs to separate concerns
1 parent ff8d443 commit 5edfaae

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

test/e2e_test.exs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ defmodule ElixirScript.E2eTest do
77
import Mox
88

99
alias ElixirScript.E2e
10-
alias ElixirScript.E2eTest.Runner
1110
alias Test.Fixtures.GitHubWorkflowRun
1211

1312
setup :verify_on_exit!
@@ -54,6 +53,29 @@ defmodule ElixirScript.E2eTest do
5453
end
5554
end
5655

56+
defp create_temp_file(content) do
57+
tmp_dir = System.tmp_dir()
58+
file_path = Path.join(tmp_dir, "temp.exs")
59+
File.write!(file_path, inspect(content))
60+
on_exit(fn -> File.rm!(file_path) end)
61+
file_path
62+
end
63+
end
64+
65+
defmodule ElixirScript.E2eTest.EndToEndTest do
66+
@moduledoc """
67+
This module contains unit tests for the E2e module's functionality,
68+
ensuring that the test file reading and parsing behaviors are working as expected.
69+
"""
70+
use ExUnit.Case
71+
import Mox
72+
73+
alias ElixirScript.E2e
74+
alias ElixirScript.E2eTest.EndToEndUtils
75+
alias Test.Fixtures.GitHubWorkflowRun
76+
77+
setup :verify_on_exit!
78+
5779
describe "end-to-end tests" do
5880
test "run e2e tests" do
5981
stub(SystemEnvMock, :get_env, fn varname, default ->
@@ -63,20 +85,12 @@ defmodule ElixirScript.E2eTest do
6385
stub(TentacatMock.ClientMock, :new, fn -> %{auth: nil, endpoint: "github"} end)
6486

6587
E2e.read_test_file()
66-
|> Enum.each(&Runner.run_test/1)
88+
|> Enum.each(&EndToEndUtils.run_test/1)
6789
end
6890
end
69-
70-
defp create_temp_file(content) do
71-
tmp_dir = System.tmp_dir()
72-
file_path = Path.join(tmp_dir, "temp.exs")
73-
File.write!(file_path, inspect(content))
74-
on_exit(fn -> File.rm!(file_path) end)
75-
file_path
76-
end
7791
end
7892

79-
defmodule ElixirScript.E2eTest.Runner do
93+
defmodule ElixirScript.E2eTest.EndToEndUtils do
8094
@moduledoc """
8195
This submodule focuses on running end-to-end tests and validating their output against expected results.
8296
"""

0 commit comments

Comments
 (0)