Merge branch 'feature/2438-users-posts-total-count' into 'develop'
[akkoma] / test / pleroma / web / metadata / player_view_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Metadata.PlayerViewTest do
6 use Pleroma.DataCase, async: true
7
8 alias Pleroma.Web.Metadata.PlayerView
9
10 test "it renders audio tag" do
11 res =
12 PlayerView.render(
13 "player.html",
14 %{"mediaType" => "audio", "href" => "test-href"}
15 )
16 |> Phoenix.HTML.safe_to_string()
17
18 assert res ==
19 "<audio controls><source src=\"test-href\" type=\"audio\">Your browser does not support audio playback.</audio>"
20 end
21
22 test "it renders videos tag" do
23 res =
24 PlayerView.render(
25 "player.html",
26 %{"mediaType" => "video", "href" => "test-href"}
27 )
28 |> Phoenix.HTML.safe_to_string()
29
30 assert res ==
31 "<video controls loop><source src=\"test-href\" type=\"video\">Your browser does not support video playback.</video>"
32 end
33 end