import { Question , User } from 'shared-library/shared/model' ; import { UserActions , UserActionTypes } from '../actions' ; import { UserActions as UAction } from 'shared-library/core/store' ; import { testData } from 'test/data' ; import { userPublishedQuestions , userUnpublishedQuestions } from './user.reducer' ; describe ( 'Reducer: userPublishedQuestions' , ( ) => { const _testReducer = userPublishedQuestions ; const questions = testData . questions . published ; it ( 'Initial State' , ( ) => { const state = _testReducer ( undefined , { type : null , payload : null } ) ; expect ( state ) . toEqual ( [ ] ) ; } ) ; it ( 'Get user Published Question' , ( ) => { const newState = _testReducer ( questions , { type : UserActionTypes . LOAD_USER_PUBLISHED_QUESTIONS_SUCCESS , payload : questions } ) ; expect ( newState ) . toEqual ( questions ) ; } ) ; } ) ; describe ( 'Reducer: userUnpublishedQuestions' , ( ) => { const _testReducer = userUnpublishedQuestions ; const questions = testData . questions . unpublished ; it ( 'Initial State' , ( ) => { const state = _testReducer ( undefined , { type : null , payload : null } ) ; expect ( state ) . toEqual ( [ ] ) ; } ) ; it ( 'Get user Published Question' , ( ) => { const newState = _testReducer ( questions , { type : UserActionTypes . LOAD_USER_PUBLISHED_QUESTIONS_SUCCESS , payload : questions } ) ; expect ( newState ) . toEqual ( questions ) ; } ) ; } ) ;