2021-03-17 08:53:44 +08:00
|
|
|
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)
|
2021-04-21 02:17:24 +08:00
|
|
|
assert content =~ ~s{console.log("Hello");}
|
2021-03-17 08:53:44 +08:00
|
|
|
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
|