ariandanim

ariandanim

Not using Mix test

Does it okay if I never use mix test?

I am currently developing app but never try to use mix test, because some of code I made custom in lib folder, sometime when i try make account like mix phx.gen.auth Accounts User users, i try to made custom in the code. but when try make mix test some failure comes in like below :

  1) test confirm email does not update email with invalid token (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:192
     match (=) failed
     code:  assert {:live_redirect, %{to: path, flash: flash}} = redirect
     left:  {:live_redirect, %{flash: flash, to: path}}
     right: {
              :redirect,
              %{
                flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."},
                to: "/users/log_in"
              }
            }
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:194: (test)



  2) test update email form renders errors with invalid data (phx-submit) (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:68
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:69: (test)



  3) test Settings page renders settings page (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:9
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, _lv, html} =
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:10: (test)

.

  4) test update email form updates the user email (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:35
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:38: (test)

.

  5) test update email form renders errors with invalid data (phx-change) (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:52
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:53: (test)

...

  6) test update password form renders errors with invalid data (phx-change) (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:121
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:122: (test)

.

  7) test confirm email updates the user email once (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:174
     match (=) failed
     code:  assert {:live_redirect, %{to: path, flash: flash}} = redirect
     left:  {:live_redirect, %{flash: flash, to: path}}
     right: {
              :redirect,
              %{
                flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."},
                to: "/users/log_in"
              }
            }
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:177: (test)

...

  8) test update password form renders errors with invalid data (phx-submit) (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:140
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:141: (test)

.

  9) test update password form updates the user password (TrainWeb.UserSettingsLiveTest)
     test/train_web/live/user_settings_live_test.exs:92
     ** (MatchError) no match of right hand side value: {:error, {:redirect, %{to: "/users/log_in", flash: %{"error" => "You must activated via link activation that send it into your mail to access this page."}}}}
     code: {:ok, lv, _html} = live(conn, ~p"/users/settings")
     stacktrace:
       test/train_web/live/user_settings_live_test.exs:95: (test)

Most Liked Responses

LostKobrakai

LostKobrakai

Don’t forget that not everyone is coding for professional reasons. Also automated tests are not the only form of testing. So even with automated tests being a useful tool they’re by no means generally required.

To answer the question though: Yes phoenix cannot automatically adjust tests to take authentication into account, given it has no idea about what content should require authentication or not. Therefore adjusting the automatically generated tests for those additional concerns is required.

emadb

emadb

Maybe, I don’t understand what are you asking.

If you don’t want to write test, you can avoid to run mix test.
The failing tests that you are showing have a pretty clear error message and should be easy to fix them in you want.

Try to explain better your problem. Thank you.

D4no0

D4no0

Working code is optional, getting paid is the important part :joy: .

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement