Fix tests

This commit is contained in:
Alexandre de Souza 2022-08-09 14:22:12 -03:00
parent 826a3eb782
commit e0f1442f5e
No known key found for this signature in database
GPG key ID: E39228FFBA346545
3 changed files with 13 additions and 1 deletions

View file

@ -6,8 +6,12 @@ defmodule Livebook.Hub.SettingsTest do
@machine_id Livebook.Utils.random_id()
test "fetch_machines/0 returns a list of persisted machines" do
for %{id: machine_id} <- Livebook.Hub.Settings.fetch_machines() do
Livebook.Storage.current().delete(:hub, machine_id)
end
machine = %Machine{id: @machine_id, name: "Foo - bar", token: "foo", color: "#FF00FF"}
assert Settings.save_machine(machine)
Settings.save_machine(machine)
assert [
%{

View file

@ -235,6 +235,8 @@ defmodule LivebookWeb.HomeLiveTest do
test "doesn't show with disabled feature flag", %{conn: conn} do
Application.put_env(:livebook, :feature_flags, hub: false)
{:ok, _view, html} = live(conn, "/")
Application.put_env(:livebook, :feature_flags, hub: true)
refute html =~ "HUBS"
end
@ -257,6 +259,8 @@ defmodule LivebookWeb.HomeLiveTest do
{:ok, _view, html} = live(conn, "/")
assert html =~ "HUBS"
assert html =~ "Foo - bar"
Livebook.Storage.current().delete(:hub, machine.id)
end
end

View file

@ -100,6 +100,10 @@ defmodule LivebookWeb.HubLiveTest do
|> Floki.find(".sidebar--hub")
|> Floki.find(".ml-1.text-sm.font-medium")
|> Floki.text() =~ "My Foo Hub"
for %{id: machine_id} <- Livebook.Hub.Settings.fetch_machines() do
Livebook.Storage.current().delete(:hub, machine_id)
end
end
end