Implementing Back-End Integration Using TDD

You already know how to fetch the customer’s details from the server—you’d do it just the way you did in Get Data from the Back End. You’ve also seen how to write acceptance and unit tests for a feature like this, but another example could really help cement your understanding of these complex concepts. It’s also worth seeing how a TDD-based flow could work, for those of you who prefer test-driven development. (If you aren’t familiar with TDD, Test Driven Development [Bec10] is a great place to get started.)

In this section, we’ll create an acceptance test that works with the client-side navigation we just implemented. Then we’ll create a unit test for ngOnInit that confirms that it’s calling the ...

Get Rails, Angular, Postgres, and Bootstrap, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.