Skip to content

Commit

Permalink
add "async: true" to all tests saves 8 sec per run of suite. Thanks to
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Nov 22, 2021
1 parent 7499915 commit 460f106
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/auth/apikey_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.ApikeyTest do
use Auth.DataCase
use Auth.DataCase, async: true
use ExUnitProperties

describe "Create an AUTH_API_KEY for a given person_id" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth/app_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.AppTest do
use Auth.DataCase
use Auth.DataCase, async: true

describe "apps" do
alias Auth.App
Expand Down
2 changes: 1 addition & 1 deletion test/auth/email_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.EmailTest do
use ExUnit.Case
use ExUnit.Case, async: true

describe "AuthMvp.Email" do
test "sendemail/1 an email" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth/log_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.LogTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true
alias Auth.UserAgent
require Logger

Expand Down
2 changes: 1 addition & 1 deletion test/auth/people_roles_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.PeopleRolesTest do
use Auth.DataCase
use Auth.DataCase, async: true

test "Auth.PeopleRoles.insert/4 happy path" do
app_id = 1
Expand Down
2 changes: 1 addition & 1 deletion test/auth/person_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.PersonTest do
use Auth.DataCase
use Auth.DataCase, async: true
alias Auth.{Person}

test "create_person/1" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth/role_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.RoleTest do
use Auth.DataCase
use Auth.DataCase, async: true
# use AuthWeb.ConnCase

describe "roles" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth/status_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.StatusTest do
use Auth.DataCase
use Auth.DataCase, async: true
alias Auth.{Status}

test "upsert_status/1 inserts or updates a status record" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth/user_agent_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Auth.UserAgentTest do
use Auth.DataCase
use Auth.DataCase, async: true
alias Auth.UserAgent

test "Auth.UserAgent.upsert/1 inserts or gets a user_agent record" do
Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/api_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.ApiControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true
alias Auth.App
alias Auth.Role

Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/app_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.AppControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true
alias Auth.App

@create_attrs %{
Expand Down
7 changes: 4 additions & 3 deletions test/auth_web/controllers/auth_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.AuthControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true
# @email System.get_env("ADMIN_EMAIL")

@app_data %{
Expand Down Expand Up @@ -432,7 +432,7 @@ defmodule AuthWeb.AuthControllerTest do

test "verify_email/2 verify an email address", %{conn: conn} do
person =
%{email: "anabela@mail.com", auth_provider: "email"}
%{email: "anabela@mail.com", auth_provider: "email", app_id: 1}
|> Auth.Person.upsert_person()

state =
Expand All @@ -458,7 +458,8 @@ defmodule AuthWeb.AuthControllerTest do
email: "ana@mail.com",
auth_provider: "email",
status: 1,
password: "thiswillbehashed"
password: "thiswillbehashed",
app_id: 1
}

Auth.Person.upsert_person(data)
Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/people_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.PeopleControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true
# @email System.get_env("ADMIN_EMAIL")

test "GET /people displays list of people", %{conn: conn} do
Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/permission_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.PermissionControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true

alias Auth.Permission

Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/ping_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.PingControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true

test "GET /ping (GIF) renders 1x1 pixel", %{conn: conn} do
conn = get(conn, Routes.ping_path(conn, :ping))
Expand Down
2 changes: 1 addition & 1 deletion test/auth_web/controllers/role_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule AuthWeb.RoleControllerTest do
use AuthWeb.ConnCase
use AuthWeb.ConnCase, async: true

alias Auth.Role

Expand Down

1 comment on commit 460f106

@plicjo
Copy link

@plicjo plicjo commented on 460f106 Nov 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 🙏

Please sign in to comment.