Skip to content

Commit

Permalink
test(controller/notifications): initial notification tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsey committed Nov 2, 2023
1 parent d1a74a2 commit e592c24
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/epochtalk_server_web/controllers/notification_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
defmodule Test.EpochtalkServerWeb.Controllers.Notification do
use Test.Support.ConnCase, async: true
alias EpochtalkServer.Models.Notification

Check warning on line 3 in test/epochtalk_server_web/controllers/notification_test.exs

View workflow job for this annotation

GitHub Actions / Run tests

unused alias Notification

describe "counts/2" do
test "when unauthenticated, returns Unauthorized error", %{conn: conn} do
response =
conn
|> get(Routes.notification_path(conn, :counts))
|> json_response(401)

assert response["error"] == "Unauthorized"
assert response["message"] == "No resource found"
end

@tag :authenticated
test "when authenticated, returns number of notifications user has", %{conn: conn} do
response =
conn
|> get(Routes.notification_path(conn, :counts))
|> json_response(200)

assert response["mentions"] == 0
assert response["message"] == 0
end
end
end

0 comments on commit e592c24

Please sign in to comment.