Skip to content

Commit

Permalink
woops
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegillet committed Oct 12, 2023
1 parent e186f52 commit ba75858
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions test/elixir_analyzer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,46 +32,46 @@ defmodule ElixirAnalyzerTest do
expected_output =
%{
"comments" => [
%{"comment" => "elixir.two-fer.use_of_function_header", type: "actionable"},
%{"comment" => "elixir.solution.use_specification", type: "actionable"},
%{"comment" => "elixir.solution.raise_fn_clause_error", type: "actionable"},
%{"comment" => "elixir.two-fer.use_of_function_header", "type" => "actionable"},
%{"comment" => "elixir.solution.use_specification", "type" => "actionable"},
%{"comment" => "elixir.solution.raise_fn_clause_error", "type" => "actionable"},
%{
"comment" => "elixir.solution.variable_name_snake_case",
"params" => %{"actual" => "_nameInPascalCase", "expected" => "_name_in_pascal_case"},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.module_attribute_name_snake_case",
"params" => %{
"actual" => "someUnusedModuleAttribute",
"expected" => "some_unused_module_attribute"
},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.module_pascal_case",
"params" => %{"actual" => "My_empty_module", "expected" => "MyEmptyModule"},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.compiler_warnings",
"params" => %{
"warnings" =>
"warning: module attribute @someUnusedModuleAttribute was set but never used\n lib/two_fer.ex:2\n\n"
},
type: "actionable"
"type" => "actionable"
},
%{"comment" => "elixir.solution.use_module_doc", type: "informative"},
%{"comment" => "elixir.solution.indentation", type: "informative"},
%{"comment" => "elixir.solution.use_module_doc", "type" => "informative"},
%{"comment" => "elixir.solution.indentation", "type" => "informative"},
%{
"comment" => "elixir.solution.private_helper_functions",
"params" => %{
"actual" => "def public_helper(_)",
"expected" => "defp public_helper(_)"
},
type: "informative"
"type" => "informative"
},
%{"comment" => "elixir.general.feedback_request", type: "informative"}
%{"comment" => "elixir.general.feedback_request", "type" => "informative"}
],
"summary" => "Check the comments for some suggestions. 📣"
}
Expand All @@ -87,11 +87,13 @@ defmodule ElixirAnalyzerTest do

expected_output =
%{
"comments" => [%{"comment" => "elixir.solution.use_module_doc", type: "informative"}],
"comments" => [
%{"comment" => "elixir.solution.use_module_doc", "type" => "informative"}
],
"summary" => "Check the comments for some things to learn. 📖"
}

assert Submission.to_json(analyzed_exercise) == expected_output
assert Submission.to_json(analyzed_exercise) |> Jason.decode!() == expected_output
end

test "error solution" do
Expand All @@ -110,7 +112,7 @@ defmodule ElixirAnalyzerTest do
"error" => "missing terminator: end (for \"do\" starting at line 1)",
"line" => 14
},
type: "essential"
"type" => "essential"
}
],
"summary" => "Check the comments for things to fix. 🛠"
Expand All @@ -136,7 +138,7 @@ defmodule ElixirAnalyzerTest do
"file_name" => "two_fer.ex",
"path" => "test_data/two_fer/missing_file_solution/"
},
type: "essential"
"type" => "essential"
}
],
"summary" => "Check the comments for things to fix. 🛠"
Expand Down Expand Up @@ -164,43 +166,43 @@ defmodule ElixirAnalyzerTest do
expected_output =
%{
"comments" => [
%{"comment" => "elixir.solution.raise_fn_clause_error", type: "actionable"},
%{"comment" => "elixir.solution.raise_fn_clause_error", "type" => "actionable"},
%{
"comment" => "elixir.solution.variable_name_snake_case",
"params" => %{"actual" => "_nameInPascalCase", "expected" => "_name_in_pascal_case"},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.module_attribute_name_snake_case",
"params" => %{
"actual" => "someUnusedModuleAttribute",
"expected" => "some_unused_module_attribute"
},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.module_pascal_case",
"params" => %{"actual" => "My_empty_module", "expected" => "MyEmptyModule"},
type: "actionable"
"type" => "actionable"
},
%{
"comment" => "elixir.solution.compiler_warnings",
"params" => %{
"warnings" =>
"warning: module attribute @someUnusedModuleAttribute was set but never used\n lib/two_fer.ex:2\n\n"
},
type: "actionable"
"type" => "actionable"
},
%{"comment" => "elixir.solution.indentation", type: "informative"},
%{"comment" => "elixir.solution.indentation", "type" => "informative"},
%{
"comment" => "elixir.solution.private_helper_functions",
"params" => %{
"actual" => "def public_helper(_)",
"expected" => "defp public_helper(_)"
},
type: "informative"
"type" => "informative"
},
%{"comment" => "elixir.general.feedback_request", type: "informative"}
%{"comment" => "elixir.general.feedback_request", "type" => "informative"}
],
"summary" => "Check the comments for some suggestions. 📣"
}
Expand All @@ -227,7 +229,9 @@ defmodule ElixirAnalyzerTest do

expected_output =
%{
"comments" => [%{"comment" => "elixir.solution.same_as_exemplar", type: "celebratory"}],
"comments" => [
%{"comment" => "elixir.solution.same_as_exemplar", "type" => "celebratory"}
],
"summary" => "You're doing something right. 🎉"
}

Expand Down Expand Up @@ -256,17 +260,17 @@ defmodule ElixirAnalyzerTest do
expected_output =
%{
"comments" => [
%{"comment" => "elixir.lasagna.function_reuse", type: "actionable"},
%{"comment" => "elixir.lasagna.function_reuse", "type" => "actionable"},
%{
"comment" => "elixir.solution.private_helper_functions",
"params" => %{
"actual" => "def public_helper(_)",
"expected" => "defp public_helper(_)"
},
type: "informative"
"type" => "informative"
},
%{"comment" => "elixir.solution.todo_comment", type: "informative"},
%{"comment" => "elixir.general.feedback_request", type: "informative"}
%{"comment" => "elixir.solution.todo_comment", "type" => "informative"},
%{"comment" => "elixir.general.feedback_request", "type" => "informative"}
],
"summary" => "Check the comments for some suggestions. 📣"
}
Expand All @@ -288,9 +292,9 @@ defmodule ElixirAnalyzerTest do
"warnings" =>
"warning: HashDict.new/0 is deprecated. Use maps and the Map module instead\n lib/lasagna.ex:7\n\nwarning: HashSet.member?/2 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\nwarning: HashSet.new/0 is deprecated. Use the MapSet module instead\n lib/lasagna.ex:12\n\nwarning: Behaviour.defcallback/1 is deprecated. Use the @callback module attribute instead\n lib/lasagna.ex:4\n\n"
},
type: "actionable"
"type" => "actionable"
},
%{"comment" => "elixir.general.feedback_request", type: "informative"}
%{"comment" => "elixir.general.feedback_request", "type" => "informative"}
],
"summary" => "Check the comments for some suggestions. 📣"
}
Expand Down

0 comments on commit ba75858

Please sign in to comment.