diff options
Diffstat (limited to 'deps/rabbitmq_cli/test/core/json_stream_test.exs')
-rw-r--r-- | deps/rabbitmq_cli/test/core/json_stream_test.exs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/deps/rabbitmq_cli/test/core/json_stream_test.exs b/deps/rabbitmq_cli/test/core/json_stream_test.exs new file mode 100644 index 0000000000..ab3bebd62c --- /dev/null +++ b/deps/rabbitmq_cli/test/core/json_stream_test.exs @@ -0,0 +1,24 @@ +## This Source Code Form is subject to the terms of the Mozilla Public +## License, v. 2.0. If a copy of the MPL was not distributed with this +## file, You can obtain one at https://mozilla.org/MPL/2.0/. +## +## Copyright (c) 2019-2020 VMware, Inc. or its affiliates. All rights reserved. + +defmodule JsonStreamTest do + use ExUnit.Case, async: false + + @formatter RabbitMQ.CLI.Formatters.JsonStream + + test "format_output map with atom keys is converted to JSON object" do + assert @formatter.format_output(%{a: :apple, b: :beer}, %{}) == "{\"a\":\"apple\",\"b\":\"beer\"}" + end + + test "format_output map with binary keys is converted to JSON object" do + assert @formatter.format_output(%{"a" => :apple, "b" => :beer}, %{}) == "{\"a\":\"apple\",\"b\":\"beer\"}" + end + + test "format_output empty binary is converted to empty JSON array" do + assert @formatter.format_output("", %{}) == "" + end + +end |