Loading
Build a TypeScript Project From Scratch Tutorial (19 exercises)
Lesson

Practice Test-Driven-Development

In this lesson, you will learn about TDD through a hands-on challenge writing a word-wrapping algorithm.

Resources

The following resources provide more information for this lesson:

Transcript

[0:00] [0: 00] I like test-driven development because it promotes testing, which leads to more code confidence and usually less bugs for your users. We'll be using this as we build our library together. I wanted to give you a small challenge to get you comfortable with TDD.
[0:14] [0: 14] The challenge will involve writing a word-wrapping algorithm. Here you have a brief description of the problem. Then, these are examples of behavior which will serve as your test cases. I've already gone ahead and set up a code sandbox with all of the test cases.

[0:29] [0: 30] All you need to do is implement the function wordWrap inside of index.ts and get your test passing. Take a second, fork the sandbox, and work through each test. I'll leave a link below with my solution, which you can check after. Good luck!