Skip to content

Commit

Permalink
Add registry tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet committed Jan 28, 2022
1 parent a4ddca0 commit f46c891
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/makeup_js/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule MakeupJs.Application do
alias Makeup.Registry

def start(_type, _args) do
Registry.register_lexer(MakeupJs,
Registry.register_lexer(Makeup.Lexers.JsLexer,
options: [],
names: ["js", "javascript"],
extensions: ["js"]
Expand Down
17 changes: 17 additions & 0 deletions test/registry_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule Makeup.Lexers.JsLexer.RegistryTest do
use ExUnit.Case, async: true

alias Makeup.Registry
alias Makeup.Lexers.JsLexer

describe "the Js lexer has successfully registered itself:" do
test "language name" do
assert {:ok, {JsLexer, []}} == Registry.fetch_lexer_by_name("js")
assert {:ok, {JsLexer, []}} == Registry.fetch_lexer_by_name("javascript")
end

test "file extension" do
assert {:ok, {JsLexer, []}} == Registry.fetch_lexer_by_extension("js")
end
end
end

0 comments on commit f46c891

Please sign in to comment.