-
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
1 parent
48be2a2
commit 39d1fba
Showing
13 changed files
with
79 additions
and
38 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
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
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
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,31 @@ | ||
defmodule UserPreferences.ActivityMonitorTest do | ||
use ExUnit.Case, async: true | ||
alias UserPreferencesWeb.Schema | ||
|
||
@get_resolver_hits """ | ||
query getResolverHits($key: String){ | ||
resolverHits(key: $key) | ||
} | ||
""" | ||
|
||
describe "@resolverHits" do | ||
test "returns the count for a resolver" do | ||
key = "get_all_users" | ||
|
||
assert {:ok, %{data: %{"resolverHits" => count}}} = | ||
Absinthe.run(@get_resolver_hits, Schema, variables: %{"key" => key}) | ||
|
||
assert count === 0 | ||
end | ||
|
||
test "returns" do | ||
key = "not_a_key" | ||
|
||
assert {:ok, %{data: %{"resolverHits" => count}, errors: errors}} = | ||
Absinthe.run(@get_resolver_hits, Schema, variables: %{"key" => "not_a_key"}) | ||
|
||
assert is_nil(count) === true | ||
assert List.first(errors).message === "Requested key: not_a_key is invalid" | ||
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,5 @@ | ||
defmodule UserPreferences.Repo do | ||
use Ecto.Repo, | ||
otp_app: :gql_preferences, | ||
adapter: Ecto.Adapters.SQL.Sandbox | ||
end |
8 changes: 0 additions & 8 deletions
8
test/gql_preferences_web/controllers/page_controller_test.exs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
defmodule UserPreferences.RepoCase do | ||
use ExUnit.CaseTemplate | ||
|
||
using do | ||
quote do | ||
alias UserPreferences.Repo | ||
|
||
import Ecto | ||
import Ecto.Query | ||
import UserPreferences.RepoCase | ||
|
||
# and any other stuff | ||
end | ||
end | ||
|
||
setup tags do | ||
:ok = Ecto.Adapters.SQL.Sandbox.checkout(UserPreferences.Repo) | ||
|
||
unless tags[:async] do | ||
Ecto.Adapters.SQL.Sandbox.mode(UserPreferences.Repo, {:shared, self()}) | ||
end | ||
|
||
:ok | ||
end | ||
end |