import { createActionWithGlobalState } from '../createActionWithGlobalState';

describe('Utils/Redux/createActionWithGlobalState', () => {
    test('creates and dispatches the correct action with the additional globalState value', () => {
        const thunkAction = createActionWithGlobalState({
            type: 'testActionType',
            customProp: 'hello',
        });
        const dispatch = jest.fn();
        const globalState = { foo: 'bar' };
        const getState = () => globalState;
        thunkAction(dispatch, getState);
        expect(dispatch).toHaveBeenCalledWith({ type: 'testActionType', customProp: 'hello', globalState });
    });
});
