43 lines
968 B
Elixir
43 lines
968 B
Elixir
defmodule PropertiesTest do
|
|
use ExUnit.Case
|
|
doctest PlugIndie.Properties
|
|
import PlugIndie.Properties, only: [parse: 1]
|
|
|
|
test "parse/1 identifies a note" do
|
|
props = %{
|
|
"content" => ["Hello World!"]
|
|
}
|
|
|
|
assert {:ok,
|
|
%PlugIndie.Post{
|
|
type: :note,
|
|
content: "Hello World!"
|
|
}} == parse(props)
|
|
end
|
|
|
|
test "parse/1 identifies a bookmark" do
|
|
props = %{
|
|
"content" => ["Hello World!"],
|
|
"bookmark-of" => ["https://100r.co"]
|
|
}
|
|
|
|
assert {:ok,
|
|
%PlugIndie.Post{
|
|
type: :bookmark,
|
|
content: "Hello World!",
|
|
bookmark_of: "https://100r.co"
|
|
}} == parse(props)
|
|
end
|
|
|
|
test "parse/1 identifies a like" do
|
|
props = %{
|
|
"like-of" => ["https://100r.co"]
|
|
}
|
|
|
|
assert {:ok,
|
|
%PlugIndie.Post{
|
|
type: :like,
|
|
like_of: "https://100r.co"
|
|
}} == parse(props)
|
|
end
|
|
end
|