You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TP_ReactNative/test/reducer/appReducer.test.js

25 lines
653 B

import appReducer from "../../redux/reducers/appReducer";
describe('Test Reducer', () => {
let initialState = {
cards: [],
favoriteCards: []
}
it('should return initial state', () => {
expect(appReducer(undefined, {})).toEqual(initialState);
});
it('should handle FETCH_DATA', () => {
const payload = [new Card("1","test1","",""),new Card("2","test2","","",true)];
expect(
appReducer(initialState, {
type: "FETCH_DATA",
payload,
})
).toEqual({
cards: payload,
favoriteCards: [],
});
});
});