Day25 ReactJS Redux Testing Slides
Day25 ReactJS Redux Testing Slides
Component
Component
Environment Setup
1. Store
2. Actions
3. Reducers
Exploring The Core Redux Concepts
1. store: it brings the actions and reducers together, holding
and changing the state for the whole app — there is only one
store.
// Reducer Function
const bankReducer = (state, action) =>
{
};
// Create Store
const bankStore = createStore(bankReducer);
export default bankStore;
Steps
<Provider store={bankStore}>
<BankApp />
</Provider>
Steps
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
function BankApp()
{
const [amount, setAmount] = useState(0);
let currentBalance = useSelector((state) => state.balance);
const dispatch = useDispatch();
}
Narasimha
Sr. IT Trainer/Consultant
Redux Tookit
Integration Testing
Unit Testing
Levels of Testing
AAA Pattern in Unit Testing
AAA Pattern
Act
01 Arrange 02 This is the middle step of a unit test. In this
This is the first step of a unit test application. Here step we will execute the test i.e. we will do the
we will arrange the test, in other words we will do actual unit testing and the result will be
the necessary setup of the test. obtained .
03 Assert
This is the last step of a unit test application. In
this step we will check and verify the returned
result with expected results.
Unit Testing Frameworks for React
• Jest
• React Testing Library
• Enzyme