Challenge: Create Unit Tests
Complete the challenge of creating unit tests for the to-do list component in the application.
We'll cover the following
Problem statement
A to-do list component has been created in the Angular application. We have written all the to-do list methods in the todo-list.component.ts
file. Your task is to create unit tests for a TodoListComponent
component that manages a to-do list.
Requirements
You are required to create the following unit tests:
Write tests to ensure that the
addTodo()
method adds new to-dos correctly.Write tests to ensure that the
updateTodo()
method updates to-do texts correctly.Write tests to ensure that the
deleteTodo()
method removes to-dos correctly.Cover edge cases such as adding, updating, and deleting to-dos when the to-do list is empty.
Test scenarios with different to-do texts, including empty text.
Expected output
After running the application, expect the following output:
Get hands-on with 1200+ tech skills courses.