-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slightly more test coverage of live views
- Loading branch information
Showing
6 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule AmbryWeb.LibraryLiveTest do | ||
use AmbryWeb.ConnCase | ||
|
||
import Phoenix.LiveViewTest | ||
|
||
setup :register_and_log_in_user | ||
|
||
test "renders the library", %{conn: conn} do | ||
%{title: book_title} = insert(:book) | ||
|
||
{:ok, _view, html} = live(conn, ~p"/library") | ||
assert html =~ escape(book_title) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
defmodule AmbryWeb.SearchLiveTest do | ||
use AmbryWeb.ConnCase | ||
|
||
import Phoenix.LiveViewTest | ||
|
||
setup :register_and_log_in_user | ||
|
||
test "renders search results page when searching for a book", %{conn: conn} do | ||
%{title: book_title} = book = insert(:book) | ||
insert_index!(book) | ||
|
||
{:ok, _view, html} = live(conn, ~p"/search/#{book_title}") | ||
|
||
assert html =~ escape(book_title) | ||
end | ||
|
||
test "renders search results page when searching for a person", %{conn: conn} do | ||
%{name: person_name} = person = insert(:person) | ||
insert_index!(person) | ||
|
||
{:ok, _view, html} = live(conn, ~p"/search/#{person_name}") | ||
|
||
assert html =~ escape(person_name) | ||
end | ||
|
||
test "renders search results page when searching for a series", %{conn: conn} do | ||
%{series_books: [%{series: %{name: series_name} = series} | _rest]} = insert(:book) | ||
insert_index!(series) | ||
|
||
{:ok, _view, html} = live(conn, ~p"/search/#{series_name}") | ||
|
||
assert html =~ escape(series_name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters