From 550ca0aacc243d89fae56b9eb58a2eebd63e0024 Mon Sep 17 00:00:00 2001 From: Inhji Date: Thu, 5 Dec 2024 15:36:43 +0100 Subject: [PATCH] improve Parser tests --- test/parser_test.exs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/test/parser_test.exs b/test/parser_test.exs index 0d9712b..096f0a1 100644 --- a/test/parser_test.exs +++ b/test/parser_test.exs @@ -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