Nice article! I'd like to add that you should use userEvent.type(input, 'matti') instead of fireEvent.change(input, {target: {value: 'matti'}});.
This way you get a better coverage and also to resemble the user interaction more closely.
Thanks!
Yes, I also wrote that there is na option to simulatet the user typing, bit I think that firing the change event is sufficient here. Simulating the actual typing kinda crosses the border between unit and automation test for me, but sure, you can simulate the typing as well.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article! I'd like to add that you should use
userEvent.type(input, 'matti')
instead offireEvent.change(input, {target: {value: 'matti'}});
.This way you get a better coverage and also to resemble the user interaction more closely.
Thanks!
Yes, I also wrote that there is na option to simulatet the user typing, bit I think that firing the change event is sufficient here. Simulating the actual typing kinda crosses the border between unit and automation test for me, but sure, you can simulate the typing as well.