In JS or TS people usually use async/await and mocks to do parts of the tests. I really dislike this approach and prefer the Elm way. But I’m struggling to find a nice pattern for my tests.
For example, when the user clicks a button or submit a form, a message is sent. I can easily test that. But I feel this is a very narrow scope for a test.
So next I usually test if the message does what it’s suppose do to, in a separated test. Is the update message catching this message? Is it updating the model as it’s supposed to and returning the right Cmd?
I find this a little strange, to have 2 tests for this. And making the assertions on the Cmd Msg of the update function is getting tricky.
What I am getting wrong here? And if you do TDD with Elm, what is your pattern to test this kind of cenario?