Skip to main content

✏️ Practice: Extending Text Analyzer Business Logic with TDD

Goal: Build out the text-analyzer business logic, making sure to practice TDD.

Warm Up


  • What is TDD? How can it help us solve problems?
  • Can we write multiple tests for one function?
  • What process do we follow when we use TDD when we are writing business logic? This means to ask: when do we write the test, when do we write the code, and when do we run the test?

Code


At this point, you should've followed along with the lessons to build the business logic for the Text Analyzer application. Complete the prompt below that extends the Text Analyzer business logic.

Extending Text Analyzer Business Logic

Write a function that omits offensive words from a text passage. For the purpose of this application, there are only four offensive words to worry about: zoinks, muppeteer, biffaroni, and loopdaloop. These words make the investors behind Text Analyzer fly into a rage. We recommend not using real offensive words because they are, well, offensive! Use TDD to build your function.