Testing live() and afterStateUpdated()
for a pest test and testing live(), should assertSet() be used? This is what i am trying, but getting null for the year_built value according to the assertSet output. If i try assertFormSet() of course i just get the original fill values.
8 Replies
im really surprised this isnt documented and/or someone else really hasnt brought it up in discord. Though in general, dont see a lot of detailed pest testing discussion in general, so maybe im just missing something. I do though get a bit detailed in some of my tests.
fillForm() can be used :)
its the same as using a form normally
so you can use it multiple times?
yes
same as assertFormData or whatever it is
and it will only fill the field that you specify?
yup!
it calls set() for each field you pass, with the correct state path prefix
so whats wrong with set() then? Is that even the issue or is it more the assertSet()? Sorry for the 20 questions and thanks. just want to make sure we are in the right direction. currently working on a different project atm
most forms have a state path
like data. or mountedActionData.
if you use fillForm() we will add that state path to the start of each field name
actually does this
except you dont have to think about the state path
same with assertSet()