All files / State createState.js

100% Statements 24/24
75% Branches 3/4
100% Functions 1/1
100% Lines 23/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x 1x   1x 1x 1x 1x 1x 1x 1x 1x   5x 5x   5x 5x   5x   5x 5x 5x 5x 5x 5x 5x   5x        
import { createState as createGlobxState } from 'globx';
import merge from 'helpful-merge';
 
import createAssetStore from './Asset/createAssetStore';
import createConfigStore from './Config/createConfigStore';
import createConcurrencyStore from './Concurrency/createConcurrencyStore';
import createPlaybackStore from './Playback/createPlaybackStore';
import createPrecisionStore from './Precision/createPrecisionStore';
import createResumePointsStore from './ResumePoints/createResumePointsStore';
import createUserActionsStore from './UserActions/createUserActionsStore';
import ingestGlobalConfigFromEnvironment from './Shared/Util/ingestGlobalConfigFromEnvironment';
 
const createState = (initialState = {}) => {
    const state = createGlobxState();
 
    const consumerConfig = initialState.config;
    const globalConfig = ingestGlobalConfigFromEnvironment();
 
    const prePopulatedConfig = merge(globalConfig, consumerConfig, true);
 
    createAssetStore(state);
    createConfigStore(state, prePopulatedConfig);
    createConcurrencyStore(state);
    createPlaybackStore(state);
    createPrecisionStore(state);
    createResumePointsStore(state);
    createUserActionsStore(state);
 
    return state;
};
 
export default createState;