The user’s data on mount/3, we shouldn’t test that we’re making that messageĬall or function call. We only care about theįor example, if our LiveView process calls another process or module to fetch The other process should test its own incoming query. From our test’s perspective, that is happening inside the black box. If LiveView makes an outgoing query to another process (or even anotherĬollaborator module), Sandi’s guide tells us that we should not explicitly test Phoenix LiveView brings a new set of testing tools and requires a new way of thinking about our tests. Whether or not that’s enough for you depends on your level ofĬonfidence on this test and the cost of using an alternative testing strategy. The test does not cover the scheduling of the timer, so that logic remains pid, :tick ) assert has_element ( view, ".notes", "These are the updated notes" ) end Test "user can add a todo", % = live ( conn, "/" ) # act as the timer by sending the message LiveView sends itself send ( view. LiveView, we can send a query message to get the LiveView’s current rendered Sandi’s guide shows that we should assert the result of an incoming query. The talk is highly applicable to testing LiveView. Think of as messages in object-oriented languages. Sandi’s talk uses Ruby, so she talked about method calls, which we should
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |