Design Server-Side Code

To practice the concepts of test-driving the design, we’ll test-drive the design of server-side code that checks if a given string is a palindrome. That’s a fairly simple problem, but keeping it simple now will help you ease into test-driven design without getting dragged too quickly into complexities. Once you get comfortable with the basics, you’ll be well prepared to handle gruesome complexities in later chapters.

JavaScript on the server side has gained prominence in recent years and Node.js has become the de facto runtime environment. It’s not only a great platform to deploy, but it’s also charming from the testability point of view. Let’s explore testing JavaScript running in Node.js with an example.

We’ll design ...

Get Test-Driving JavaScript Applications 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.