elm-program-test
elm-program-test copied to clipboard
Add a way to get the model from a `ProgramTest`
I'm storing some data inside the model that I would like to use on the tests to compute some values.
For example, I'm storing the currentDate inside the model, and later on I need the currentdate to mock an HTTP response.
So I would like to be able to do something like:
start
|> ProgramTest.withModel
(\model ->
ProgramTest.simulateHttpOk "POST" mockUrl (responseSuccess model.currentDate)
)
|> ProgramTest.clickButton "button"
|> ProgramTest.expectViewHasNot [ Selector.id "test-id" ]
The signature of the function could be something like:
withModel : (model -> ProgramTest model msg effect -> ProgramTest model msg effect) -> ProgramTest model msg effect -> ProgramTest model msg effect
What do you think? If you agree I could even open a PR myself :)
I feel this could be kinda related to #127 even though it is not exactly the same
@avh4 is this library being maintained? Otherwise, are there any alternatives?