Skip to content

Commit

Permalink
wip(accounts): trying to cover for Accounts.update_account()
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielparizet committed Jun 3, 2024
1 parent d759de1 commit 77f89e6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/book_my_gigs/accounts/accounts_test.exs
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

0 comments on commit 77f89e6

Please sign in to comment.