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

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: .

Last Post!

dimitarvp

dimitarvp

I didn’t intend to discredit it, sorry if it sounded that way.


And, as I work for a telecom nowadays I get it that not everything can be neatly put into automated tests indeed. Or stuff like Nerves[-like] environments where you actually have to send physical signals – another valid use-case.

So yeah I don’t disagree with you either, it’s just that I’d always default to automated tests if the environment allows for it. If for no any other reason than this one: from one point and on I want to progress and automated tests give you confidence that you at least didn’t break what was working before.

Where Next?

Popular in Questions Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
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
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
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

We're in Beta

About us Mission Statement