Changeset View
Changeset View
Standalone View
Standalone View
lib/reducers/report-store-reducer.test.js
// @flow | // @flow | ||||
import reduceReportStore from './report-store-reducer.js'; | import reduceReportStore from './report-store-reducer.js'; | ||||
import type { LogInResult } from '../types/account-types.js'; | import type { LogInResult } from '../types/account-types.js'; | ||||
import type { LoadingInfo } from '../types/loading-types.js'; | import type { LoadingInfo } from '../types/loading-types.js'; | ||||
import type { AppState, BaseAction } from '../types/redux-types.js'; | import type { AppState, BaseAction } from '../types/redux-types.js'; | ||||
import { | import { | ||||
type ReportStore, | type ReportStore, | ||||
reportTypes, | reportTypes, | ||||
type MediaMissionReportCreationRequest, | type ClientMediaMissionReportCreationRequest, | ||||
type ErrorReportCreationRequest, | type ClientErrorReportCreationRequest, | ||||
type EnabledReports, | type EnabledReports, | ||||
type ClientThreadInconsistencyReportCreationRequest, | type ClientThreadInconsistencyReportCreationRequest, | ||||
} from '../types/report-types.js'; | } from '../types/report-types.js'; | ||||
const loadingInfo: LoadingInfo = { | const loadingInfo: LoadingInfo = { | ||||
fetchIndex: 0, | fetchIndex: 0, | ||||
trackMultipleRequests: false, | trackMultipleRequests: false, | ||||
customKeyName: undefined, | customKeyName: undefined, | ||||
}; | }; | ||||
// this is only for types compatibility and `any` will not have any influence | // this is only for types compatibility and `any` will not have any influence | ||||
// on tests correctness | // on tests correctness | ||||
const defaultState: AppState = ({}: any); | const defaultState: AppState = ({}: any); | ||||
const defaultBaseAction: BaseAction = ({ | const defaultBaseAction: BaseAction = ({ | ||||
payload: ({}: any), | payload: ({}: any), | ||||
loadingInfo, | loadingInfo, | ||||
}: any); | }: any); | ||||
const defaultAction = { | const defaultAction = { | ||||
payload: ({}: any), | payload: ({}: any), | ||||
loadingInfo, | loadingInfo, | ||||
}; | }; | ||||
const mockErrorReport: ErrorReportCreationRequest = { | const mockErrorReport: ClientErrorReportCreationRequest = { | ||||
type: reportTypes.ERROR, | type: reportTypes.ERROR, | ||||
platformDetails: { platform: 'web' }, | platformDetails: { platform: 'web' }, | ||||
errors: [], | errors: [], | ||||
preloadedState: defaultState, | preloadedState: defaultState, | ||||
currentState: defaultState, | currentState: defaultState, | ||||
actions: [], | actions: [], | ||||
id: '1-1', | id: '1-1', | ||||
}; | }; | ||||
const mockInconsistencyReport: ClientThreadInconsistencyReportCreationRequest = | const mockInconsistencyReport: ClientThreadInconsistencyReportCreationRequest = | ||||
{ | { | ||||
type: reportTypes.THREAD_INCONSISTENCY, | type: reportTypes.THREAD_INCONSISTENCY, | ||||
platformDetails: { platform: 'web' }, | platformDetails: { platform: 'web' }, | ||||
beforeAction: {}, | beforeAction: {}, | ||||
action: defaultBaseAction, | action: defaultBaseAction, | ||||
pushResult: {}, | pushResult: {}, | ||||
lastActions: [], | lastActions: [], | ||||
time: 0, | time: 0, | ||||
id: '1-2', | id: '1-2', | ||||
}; | }; | ||||
const mockMediaReport: MediaMissionReportCreationRequest = { | const mockMediaReport: ClientMediaMissionReportCreationRequest = { | ||||
type: reportTypes.MEDIA_MISSION, | type: reportTypes.MEDIA_MISSION, | ||||
platformDetails: { platform: 'web' }, | platformDetails: { platform: 'web' }, | ||||
time: Date.now(), | time: Date.now(), | ||||
mediaMission: { | mediaMission: { | ||||
steps: [], | steps: [], | ||||
result: { success: true }, | result: { success: true }, | ||||
totalTime: 0, | totalTime: 0, | ||||
userTime: 0, | userTime: 0, | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |