Writing the test case
If you review the addTask method, you will notice that the logic we have is to fetch the total length of the already existing task, and increment it by 1 to create a new ID for a new task. Then we add this new task to the list of existing tasks in our board object.
So, we will write two test cases. One will be to add the first task in our board object, and the other will add a task to the already existing list. These test cases are very simple, and the purpose of us choosing these test cases is to make sure we focus on how to write test cases, rather than focusing on the content of the test case itself.
By now, we know that the first step is adding the required import statements, and the following is the code for our ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access