jest.unmock('redux');
jest.unmock('react-redux');
jest.unmock('sinon');

jest.unmock('../reducer');
jest.unmock('../connect');

import React, { Component } from 'react';
import { createStore } from 'redux';
import TestUtils from 'react-addons-test-utils';
import sinon from 'sinon';

import ActionTypes from '../ActionTypes';
import repressReducer from '../reducer';
import repressConnect from '../connect';

const renderer = TestUtils.createRenderer();
const store = createStore(repressReducer, { repress: {} });

const testPostTypeName = 'TestPostType';

const testProps = {
  store,
  params: {
    id: 'test_post_id'
  }
};

const testConnectOptions = {
  postType: testPostTypeName
};

@repressConnect()
class ConnectedComponent extends Component {
  constructor (props, context) {
    super(props, context);
  }

  render () {
    return (<div>Hello, World!</div>);
  }
}

describe('Repress connect', () => {
  it('wraps a component', () => {
    expect(ConnectedComponent.__repress).toBe(true);
  });
});

describe('Repress connected component', () => {
  const originalDispatch = store.dispatch;

  beforeAll(() => sinon.spy(store, 'dispatch'));

  afterAll(() => {
    store.dispatch = originalDispatch;
  })

  const component = <ConnectedComponent {...testProps} testProp={true} />;

  it('passes props down to children', () => {
    const rendered = renderer.render(component);
    expect(rendered.props.testProp).toBe(true);
  });

  it('dispatches an action corresponding to given configuration', () => {
    store.dispatch.calledWith({
      type: ActionTypes.REQUEST_POST,
      params: testProps.params,
      connectOptions: testConnectOptions
    });
  });
});

@@ -200,16 +200,55 @@
 redux';%0A
+import %7B connect %7D from 'react-redux';%0A
 import T
@@ -747,16 +747,17 @@
 )%0Aclass 
+_
 Connecte
@@ -912,16 +912,125 @@
 %0A  %7D%0A%7D%0A%0A
+const ConnectedComponent = connect((state) =%3E (%7B%0A  helloFromMapStateToProps: true%0A%7D))(_ConnectedComponent);%0A%0A
 describe
@@ -1359,16 +1359,17 @@
 ch;%0A  %7D)
+;
 %0A%0A  cons
@@ -1436,16 +1436,63 @@
 rue%7D /%3E;
+%0A  const rendered = renderer.render(component);
 %0A%0A  it('
@@ -1535,30 +1535,31 @@
 %3E %7B%0A    
-const 
+expect(
 rendered
  = rende
@@ -1554,38 +1554,126 @@
 ered
- = renderer.render(component);
+.props.testProp).toBe(true);%0A  %7D);%0A%0A  it('does not inhibit redux connect from performing own mapStateToProps', () =%3E %7B
 %0A   
@@ -1691,32 +1691,48 @@
 dered.props.
-test
+helloFromMapStateTo
 Prop
+s
 ).toBe(true)

Test user's own mapStateToProps still functions;