Now we will write code in our application class to fix the test, that is, for it to go green. This will be done in baby steps, and we will only fix the issue the test complains about in each of the steps. This is where the term "test-driven" takes root. Our test is driving our implementation. At no point are we free to jump to conclusions.
Note
As you get better with your TDD, it is forgivable to jump a few steps. For appreciation and empathy with TDD, we will follow TDD in its purest form in this chapter.
From the error we got in our last run, that is, an implementation is missing, we can see that the test runner is complaining about a missing implementation of the function decimalToBinary
.
To make our test pass, the simplest thing we can do is make function decimalToBinary
return the literal expected in the test.