-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
48 additions
and
4 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,20 @@ | ||
defmodule AppApi.CaptureControllerTest do | ||
use AppApiWeb.ConnCase | ||
alias AppApiWeb.CaptureController | ||
|
||
describe "test captures endpoint" do | ||
test "index and show and create endpoints", %{conn: conn} do | ||
conn = post(conn, Routes.capture_path(conn, :create, text: "text capture")) | ||
create_response = json_response(conn, 200) | ||
assert create_response["data"]["text"] == "text capture" | ||
|
||
conn = get(conn, Routes.capture_path(conn, :index)) | ||
list_captures = json_response(conn, 200) | ||
assert Enum.count(list_captures) == 1 | ||
|
||
conn = get(conn, Routes.capture_path(conn, :show, create_response["data"]["capture_id"])) | ||
get_capture_response = json_response(conn, 200) | ||
assert get_capture_response["data"]["text"] == "text capture" | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule AppApi.TagControllerTest do | ||
use AppApiWeb.ConnCase | ||
alias AppApi.Tags | ||
|
||
@valid_attrs %{id_person: 42, text: "tag1"} | ||
|
||
def tag_fixture(attrs \\ %{}) do | ||
attrs | ||
|> Enum.into(@valid_attrs) | ||
|> Tags.create_tag() | ||
end | ||
|
||
describe "test tag endoints" do | ||
test "index endpoint", %{conn: conn} do | ||
tag_fixture() | ||
conn = get(conn, Routes.tag_path(conn, :index)) | ||
response = get_response = json_response(conn, 200) | ||
assert Enum.count(response["data"]) == 1 | ||
end | ||
end | ||
end |
Empty file.