Skip to content

Commit 806ae51

Browse files
committed
fix failing tests
1 parent 4f467c3 commit 806ae51

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

lib/elixir_newbie_web/live/podcast_live.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ defmodule ElixirNewbieWeb.PodcastLive do
149149
<%= @play_speed %>x
150150
</button>
151151
<.form class="hidden items-center justify-center md:flex" phx-change="set-volume" for={%{}}>
152-
<Heroicons.speaker_x_mark id="player-speaker-x-mark" phx-click="toggle_mute" :if={@muted} class="h-6 w-6 cursor-pointer" />
153-
<Heroicons.speaker_wave id="player-speaker-wave" phx-click="toggle_mute" :if={not @muted} class="h-6 w-6 cursor-pointer" />
152+
<Heroicons.speaker_x_mark id="player-speaker-x-mark" phx-click="toggle_mute" :if={@muted or @volume == 0.0} class="h-6 w-6 cursor-pointer" />
153+
<Heroicons.speaker_wave id="player-speaker-wave" phx-click="toggle_mute" :if={not @muted and @volume != 0.0} class="h-6 w-6 cursor-pointer" />
154154
<input
155155
id="player-volume"
156156
phx-change="set-volume"
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
defmodule ElixirNewbieWeb.CommunityLiveTest do
1+
defmodule ElixirNewbieWeb.DiscordLiveTest do
22
use ElixirNewbieWeb.ConnCase
3-
doctest ElixirNewbieWeb.CommunityLive
4-
alias ElixirNewbieWeb.CommunityLive
3+
doctest ElixirNewbieWeb.DiscordLive
4+
alias ElixirNewbieWeb.DiscordLive
55

66
test "connected mount", %{conn: conn} do
7-
assert {:ok, _view, html} = live(conn, ~p"/community")
7+
assert {:ok, _view, html} = live(conn, ~p"/discord")
88
assert html =~ "Let&#39;s Learn Together!"
99
end
1010

1111
test "next_saturday/1" do
1212
today = ~D[2023-02-19]
1313
expected = "Saturday, February 25"
14-
assert CommunityLive.next_saturday(today) == expected
14+
assert DiscordLive.next_saturday(today) == expected
1515
end
1616

1717
test "next_saturday/1 wrap around month" do
1818
today = ~D[2023-02-28]
1919
expected = "Saturday, March 04"
20-
assert CommunityLive.next_saturday(today) == expected
20+
assert DiscordLive.next_saturday(today) == expected
2121
end
2222

2323
test "next_saturday/1 wrap around year" do
2424
today = ~D[2023-12-31]
2525
expected = "Saturday, January 06"
26-
assert CommunityLive.next_saturday(today) == expected
26+
assert DiscordLive.next_saturday(today) == expected
2727
end
2828
end

test/elixir_newbie_web/live/podcast_live_test.exs

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ defmodule ElixirNewbieWeb.PodcastLiveTest do
4040
assert assert_push_event(view, "backward", %{})
4141
end
4242

43-
test "time-update", %{conn: conn} do
43+
test "initial player time", %{conn: conn} do
4444
assert {:ok, view, _html} = live(conn, ~p"/podcast")
45-
assert view |> element("#player-time") |> render() =~ "0:00"
46-
assert render_hook(view, "time-update", %{seconds: 15})
47-
assert view |> element("#player-time") |> render() =~ "0:15"
45+
episode = Podcast.latest_episode()
46+
assert view |> element("#player-current-time") |> render() =~ "0:00"
47+
assert view |> element("#player-total-time") |> render() =~ episode.hh_mm_ss
4848
end
4949

5050
test "set-volume", %{conn: conn} do

test/elixir_newbie_web/wallaby/snapshot_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule ElixirNewbieWeb.Wallaby.SnapshotTests do
1515
"blog",
1616
"resources",
1717
"podcast",
18-
"community"
18+
"discord"
1919
]
2020

2121
@tag :wallaby

0 commit comments

Comments
 (0)