Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube test most popular videos reducer
import videosReducer from '../videos';
import {MOST_POPULAR } from '../../actions/video';
import {SUCCESS} from '../../actions';
import mostPopularResponse from './responses/MOST_POPULAR_SUCCESS';
import mostPopularSuccessState from './states/MOST_POPULAR_SUCCESS';
const initialState = {
byId: {},
mostPopular: {},
describe('videos reducer', () => {
test('test undefined action type and initial state with videos reducer', () => {
const expectedEndState = {...initialState};
expect(videosReducer(undefined, {type: 'some-unused-type'})).toEqual(expectedEndState);
test('test MOST_POPULAR_SUCCESS action in video reducer', () => {
const startState = {...initialState};
const action = {
response: mostPopularResponse,
const expectedEndState = {
expect(videosReducer(startState, action)).toEqual(expectedEndState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.