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.

22 lines
824 B

import { FAVORITE_CITY_DATA, WEATHER_DATA } from "../data/stub";
import appReducer from "../redux/reducers/appReducer"
describe('test reducer', () => {
let initialState = {
weatherListSearched : [],
favoriteWeather : null,
favoriteCity : null,
weatherList : []
}
it('should return initial state', () => {
expect(appReducer(undefined, {})).toEqual(initialState);
})
it('should handle favorite city', () => {
expect(appReducer(initialState, {type : 'FETCH_FAVORITE_CITY', FAVORITE_CITY_DATA})).toEqual({weatherList : [], favoriteCity : FAVORITE_CITY_DATA})
})
it('should handle weather', () => {
expect(appReducer(initialState, {type : 'FETCH_WEATHER', WEATHER_DATA})).toEqual({weatherList : [WEATHER_DATA], favoriteCity : null})
})
})