Skip to content

Commit 83ff10b

Browse files
author
Duc Le
committed
Add a test to ensure the rendering
1 parent d644470 commit 83ff10b

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/App.test.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/Todo.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const Todo = () => {
4242

4343
// Save to localStorage
4444
saveTodoItemsToLocalStorage('todo', newTodoItems)
45-
console.log(newTodoItems)
4645
}, [todoItems]) // Dependencies list for useCallback
4746

4847
const removeTodoHandler = useCallback(id => {

src/Todo.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render } from '@testing-library/react';
3+
import Todo from './Todo';
4+
5+
test('renders add todo input', () => {
6+
const { getByPlaceholderText } = render(<Todo />);
7+
const addTodoInputElement = getByPlaceholderText(/What needs to be done?/i);
8+
expect(addTodoInputElement).toBeInTheDocument();
9+
});

0 commit comments

Comments
 (0)