import { shallow } from 'enzyme';
import { expect } from 'chai';
import React from 'react';

import Home from './Home';

function setup() {
  const props = {
    errorMessages: [],

    homeActions: {}
  }

  return shallow(<Home {...props} />)
}

describe('Home', () => {
  it('should render boards component', () => {
    const wrapper = setup();

    expect(wrapper.find('Connect(Boards)')).to.have.length(1);
    expect(wrapper.find('Notification')).to.have.length(0);
  })

  it('should render notification component', () => {
    const wrapper = setup();

    expect(wrapper.find('Notification')).to.have.length(0);
    wrapper.setProps({ errorMessages: ['There is an error'] });
    expect(wrapper.find('Notification')).to.have.length(1);
  })
})
@@ -9,16 +9,23 @@
  shallow
+, mount
  %7D from 
@@ -34,16 +34,56 @@
 nzyme';%0A
+import %7B Provider %7D from 'react-redux';%0A
 import %7B
@@ -105,16 +105,43 @@
 'chai';%0A
+import sinon from 'sinon';%0A
 import R
@@ -171,181 +171,1289 @@
 ort 
-Home from './Home';%0A%0Afunction setup() %7B%0A  const props = %7B%0A    errorMessages: %5B%5D,%0A%0A    homeActions: %7B%7D%0A  %7D%0A%0A  return shallow(%3CHome %7B...props%7D /%3E)%0A%7D%0A%0Adescribe('Home', () =%3E %7B%0A
+configureMockStore from 'redux-mock-store';%0Aimport thunk from 'redux-thunk';%0Aimport nock from 'nock';%0A%0Aimport HomeContainer from './HomeContainer';%0Aimport Home from './Home';%0A%0Aconst setupShallow = () =%3E %7B%0A  const props = %7B%0A    errorMessages: %5B%5D,%0A%0A    homeActions: %7B%7D%0A  %7D%0A%0A  return shallow(%3CHome %7B...props%7D /%3E)%0A%7D%0A%0Aconst setupMount = () =%3E %7B%0A  const initialState = %7B%0A    app: %7B%0A      errorMessage: '',%0A      fullName: 'Mous',%0A      isFetching: true,%0A      isFetchingUser: false,%0A      isFetchingUserSuccessful: true,%0A      userId: '1'%0A    %7D,%0A    starredBoard: %7B %0A      starredBoards: %5B%5D %0A    %7D,%0A    organization: %7B %0A      organizations: %5B%5D %0A    %7D,%0A    board: %7B %0A      boards: %5B%5D %0A    %7D,%0A    modals: %7B%0A      isCreateOrganizationModalOpen: false,%0A      isCreateBoardModalOpen: false,%0A      isFocusOnModal: false,%0A      isModalOpen: false%0A    %7D,%0A    notification: %7B%0A      errorMessages: %5B%5D, %0A      isPopOverOpen: false%0A    %7D,%0A    homeActions: %7B%7D%0A  %7D;%0A%0A  const middlewares = %5B thunk %5D;%0A  const mockStore = configureMockStore(middlewares);%0A  const store = mockStore(initialState);%0A  %0A  return mount(%0A    %3CProvider store=%7B store %7D%3E%0A      %3CHomeContainer /%3E%0A    %3C/Provider%3E); %0A%7D;%0A%0Adescribe('Home', () =%3E %7B%0A  afterEach(() =%3E %7B%0A    nock.cleanAll();%0A  %7D)%0A%0A  describe('Home - render', () =%3E %7B%0A  
   it
@@ -1491,32 +1491,34 @@
 t', () =%3E %7B%0A    
+  
 const wrapper = 
@@ -1514,32 +1514,39 @@
  wrapper = setup
+Shallow
 ();%0A%0A    expect(
@@ -1530,32 +1530,34 @@
 Shallow();%0A%0A    
+ 
+ 
 expect(wrapper.f
@@ -1599,16 +1599,18 @@
 gth(1);%0A
+  
     expe
@@ -1661,24 +1661,26 @@
 gth(0);%0A
+  
   %7D)%0A%0A  
 it('shou
@@ -1671,16 +1671,18 @@
   %7D)%0A%0A  
+ 
+ 
 it('shou
@@ -1724,24 +1724,26 @@
 () =%3E %7B%0A    
+  
 const wrappe
@@ -1751,21 +1751,30 @@
  = setup
+Shallow
 ();%0A%0A
+  
     expe
@@ -1829,16 +1829,18 @@
 0);%0A    
+  
 wrapper.
@@ -1891,24 +1891,26 @@
 r'%5D %7D);%0A    
+  
 expect(wrapp
@@ -1953,15 +1953,308 @@
 gth(1);%0A
+    %7D)%0A  %7D)%0A%0A  describe('Home - component lifecycle', () =%3E %7B%0A    it('should call componentDidMount method', () =%3E %7B%0A      let spy = sinon.spy(Home.prototype, 'componentDidMount');%0A%0A      const wrapper = setupMount();%0A%0A      expect(spy.calledOnce).to.equal(true);%0A%0A      spy.restore();%0A    %7D)%0A
   %7D)%0A%7D)

Refactor Home unit tests