diff --git a/test/app_web/live/app_live_test.exs b/test/app_web/live/app_live_test.exs new file mode 100644 index 0000000..8221171 --- /dev/null +++ b/test/app_web/live/app_live_test.exs @@ -0,0 +1,8 @@ +defmodule AppWeb.AppLiveTest do + use AppWeb.ConnCase + + test "GET /", %{conn: conn} do + conn = get(conn, "/") + assert html_response(conn, 200) =~ "Sleep Tracker" + end +end \ No newline at end of file diff --git a/tutorial.md b/tutorial.md index cbb2479..35a602c 100644 --- a/tutorial.md +++ b/tutorial.md @@ -274,7 +274,7 @@ file to the following: Don't worry, we will improve on both of these files later. -### 6. Update `router.ex` +## 6. Update `router.ex` Open the `lib/app_web/router.ex` file and replace the line: @@ -289,6 +289,103 @@ With: live "/", AppLive ``` +## Checkpoint: Working LiveView App 📍 + +At this stage, +if you run the project: + +```sh +mix phx.server +``` + +Open the URL http://localhost:4000 +in your Web Browser; +you should see something similar to this: + + + + + + +## 7. Update Tests + +If you attempt to run the tests in the project now: + +```sh +mix test +``` + +One of the tests will fail: + + +```elixir +Generated app app +.. + + 1) test GET / (AppWeb.PageControllerTest) + test/app_web/controllers/page_controller_test.exs:4 + Assertion with =~ failed + code: assert html_response(conn, 200) =~ "Welcome to Phoenix!" + left: "\n\n
\n \n \n \n