Archives: FAQs

Q. What are service stubs / mocks, and why use them in form testing?

A: Service stubs are simple ES6 classes implementing the same methods (and return types) as a real service, but returning mock data or controlled behavior. They are used to avoid making real HTTP calls or external dependencies during unit tests — ensuring tests are fast, deterministic, and focused on form and component logic.

Q. What kind of validations are covered?

A: The post covers email validations, maximum characters for text fields, numeric field bounds, date bounds, and patterns (regex), as well as tests for enabling/disabling buttons depending on form validity.

Q. Why is form-testing important?

A: Because forms are often where user input, validation logic, asynchronous behavior (e.g., debouncing or reactive forms), and user interaction come together — mistakes here can lead to bugs, security issues (e.g. XSS, SQL injection), or bad UX. Effective testing ensures validations, button states, and reactive behavior work as intended.

Back To Top