-
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.
wip(accounts): trying to cover for Accounts.update_account()
- Loading branch information
1 parent
d759de1
commit 77f89e6
Showing
1 changed file
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
defmodule BookMyGigs.Accounts.AccountsTest do | ||
use BookMyGigs.DataCase, async: true | ||
doctest BookMyGigs | ||
|
||
alias BookMyGigs.Repo | ||
alias BookMyGigs.Accounts | ||
alias BookMyGigs.Accounts.Storage | ||
|
||
test "update_accounts can update an email and/or a password" do | ||
account = | ||
%Storage.Account{ | ||
email: "test@gmail.com", | ||
hash_password: "ThisIsMyPassword123?" | ||
} | ||
|> Repo.insert!() | ||
|
||
|
||
email_params = %{ | ||
"account" => %{ | ||
"email" => "modified_email@gmail.com", | ||
} | ||
} | ||
|
||
assert Accounts.update_account(email_params, account.id) == | ||
%Accounts.Account{ | ||
:email => "modified_email@gmail.com", | ||
:hash_password => "ThisIsMyPassword123?" | ||
} | ||
|
||
hash_password_params = %{ | ||
"account" => %{ | ||
"hash_password" => "ModifiedPassword123?" | ||
} | ||
} | ||
|
||
assert Accounts.update_account(hash_password_params, account.id) == | ||
%Accounts.Account{ | ||
:email => "modified_email@gmail.com", | ||
:hash_password => "ModifiedPassword123?" | ||
} | ||
end | ||
end |