improve Parser tests
This commit is contained in:
parent
12005618a9
commit
550ca0aacc
1 changed files with 27 additions and 2 deletions
|
@ -7,11 +7,36 @@ defmodule ParserTest do
|
||||||
params = %{
|
params = %{
|
||||||
"type" => ["h-entry"],
|
"type" => ["h-entry"],
|
||||||
"properties" => %{
|
"properties" => %{
|
||||||
"content" => "Hello World!"
|
"name" => ["First Note"],
|
||||||
|
"content" => ["Hello World!"],
|
||||||
|
"category" => ["Foo", "Bar"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert {:ok, "entry", %{"content" => "Hello World!"}} =
|
assert {:ok, "entry",
|
||||||
|
%{
|
||||||
|
"content" => ["Hello World!"],
|
||||||
|
"category" => ["Foo", "Bar"],
|
||||||
|
"name" => ["First Note"]
|
||||||
|
}} ==
|
||||||
parse_create_body("application/json", params)
|
parse_create_body("application/json", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "parse_create_body with content-type form" do
|
||||||
|
params = %{
|
||||||
|
"h" => "entry",
|
||||||
|
"name" => "First Note",
|
||||||
|
"content" => "Hello World!",
|
||||||
|
"category" => ["Foo", "Bar"]
|
||||||
|
}
|
||||||
|
|
||||||
|
# TODO: fix content type
|
||||||
|
assert {:ok, "entry",
|
||||||
|
%{
|
||||||
|
"content" => ["Hello World!"],
|
||||||
|
"category" => ["Foo", "Bar"],
|
||||||
|
"name" => ["First Note"]
|
||||||
|
}} ==
|
||||||
|
parse_create_body("application/form", params)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue