How React Testing Library Can Improve Your Mental Health [Part 2]

Written by mac | Published 2020/12/23
Tech Story Tags: react | reactjs | unit-testing | testing | tutorial | tutorial-for-beginners | react-tutorial | hackernoon-top-story

TLDR The key is to find the action type to set to the current todo element. We want to call appReducer with an initialState object, and a second argument. This one should be an object with type = “todos/todoAdded” and a payload. And then make sure that the result contains all previous todo with the one we passed as payload. Let’s go to nextTodoId (todos.reduce(maxId, todo) and test for that in the assertion.via the TL;DR App

no story

Written by mac | During the day a developer. A husband and dad at night.
Published by HackerNoon on 2020/12/23