What’s the best way to write unit tests for a form?
I’ve been building a sign up form with this and was wondering what the right way is to write unit tests for testing the logic performed on submission and form validation?
2 Replies
fair-rose•6d ago
Isn't that too big of a unit? I'd probably test this using in a Component or E2E-Test
Intercept the call to your Backend - assert that it's made - and mock return a HTTP 200 response
fascinating-indigoOP•6d ago
Ah yeah it's quite a big one to unit test to be honest, I'll see how I can intercept the backend calls properly because I'm using better-auth