improve Parser tests

This commit is contained in:
Inhji 2024-12-05 15:36:43 +01:00
parent 12005618a9
commit 550ca0aacc

View file

@ -7,11 +7,36 @@ defmodule ParserTest do
params = %{
"type" => ["h-entry"],
"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)
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