livebook/test/livebook_web/plugs/file_system_provider_test.exs
2021-04-20 20:17:24 +02:00

21 lines
578 B
Elixir

defmodule LivebookWeb.FileSystemProviderTest do
use ExUnit.Case, async: true
defmodule MyProvider do
use LivebookWeb.FileSystemProvider,
from: Path.expand("../../support/static", __DIR__)
end
test "includes regular files" do
assert %{content: content} = MyProvider.get_file(["js", "app.js"], nil)
assert content =~ ~s{console.log("Hello");}
end
test "ignores directories" do
assert nil == MyProvider.get_file(["js"], nil)
end
test "ignores non-existent files" do
assert nil == MyProvider.get_file(["nonexistent.js"], nil)
end
end