@@ -554,6 +554,11 @@ defmodule ValueFormattersTest do
554554 { :ok , "123.1345°, 34.123°, 2 m" }
555555 end
556556
557+ test "full coordinates as string" do
558+ assert ValueFormatters . to_string ( "123.1345, 34.123, 2" , % { "format" => "coordinates" } , @ opts ) ==
559+ { :ok , "123.1345°, 34.123°, 2 m" }
560+ end
561+
557562 test "inference object with radius" do
558563 assert ValueFormatters . to_string (
559564 % { "lat" => 43.1298 , "lng" => 54.1234 , "radius" => 1 } ,
@@ -578,6 +583,11 @@ defmodule ValueFormattersTest do
578583 { :ok , "123.1345°, 34.123°" }
579584 end
580585
586+ test "inference list as string" do
587+ assert ValueFormatters . to_string ( [ "123.1345" , "34.123" ] , % { } , @ opts ) ==
588+ { :ok , "123.1345°, 34.123°" }
589+ end
590+
581591 test "with radius show radius" do
582592 assert ValueFormatters . to_string (
583593 % { "lat" => 123.134567 , "lng" => 34.12345 , "radius" => 2 } ,
@@ -606,10 +616,32 @@ defmodule ValueFormattersTest do
606616 end
607617 end
608618
609- test "call with empty object format desription " do
619+ test "call with empty object format description " do
610620 assert ValueFormatters . to_string ( 3.14244453 , % { "precision" => 2 } , @ opts ) == { :ok , "3.14" }
611621 end
612622
623+ describe "array" do
624+ test "doesn't format an arrays of maps with 2 elements" do
625+ assert ValueFormatters . to_string ( [ % { "foo" => "bar" } , % { "bar" => "foo" } ] , % { } , @ opts ) ==
626+ {
627+ :error ,
628+ "Unsupported format The type of value [%{\" foo\" => \" bar\" }, %{\" bar\" => \" foo\" }] is not supported."
629+ }
630+ end
631+
632+ test "doesn't format an arrays of maps with 3 elements" do
633+ assert ValueFormatters . to_string (
634+ [ % { "foo" => "bar" } , % { "bar" => "foo" } , % { "baz" => "qux" } ] ,
635+ % { } ,
636+ @ opts
637+ ) ==
638+ {
639+ :error ,
640+ "Unsupported format The type of value [%{\" foo\" => \" bar\" }, %{\" bar\" => \" foo\" }, %{\" baz\" => \" qux\" }] is not supported."
641+ }
642+ end
643+ end
644+
613645 describe "render" do
614646 test "render unit html" do
615647 assert ValueFormatters . to_string (
0 commit comments