From ce403cf3d2ce72490bb4ed16d31230a8001e865b Mon Sep 17 00:00:00 2001 From: corrado4eyes Date: Tue, 3 Dec 2019 17:50:44 +0100 Subject: [PATCH] [#9] Updated test --- hearthstone/__tests__/app.test.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hearthstone/__tests__/app.test.tsx b/hearthstone/__tests__/app.test.tsx index 6ceeca23..d52ec97c 100644 --- a/hearthstone/__tests__/app.test.tsx +++ b/hearthstone/__tests__/app.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import ConnectedApp, {App} from '../src/App'; -import {shallow, ShallowWrapper} from 'enzyme' +import {shallow, mount, ShallowWrapper, ReactWrapper} from 'enzyme' import { dummyCardArray } from './__mocks__/mockObjects'; import Card from '../src/model/card'; import { RootState, initialState } from '../src/redux/reducers/mainReducer'; @@ -23,6 +23,10 @@ describe('App', () => { component.setState({cards: cards}) expect(component).toMatchSnapshot(); }); + + it('fires dispatchSyncCard onComponentDidMount', () => { + expect(dispatchSyncCard).toHaveBeenCalledTimes(1); + }); }); describe('App(connected)', () => { @@ -32,7 +36,7 @@ describe('App', () => { state.card.cards = dummyCardArray; state.card.cardSet = cardSet const store = generateMockStore(state) - const component: ShallowWrapper = shallow(); + const component: ReactWrapper = mount(); it('checks the props', () => { expect(component.find(App).prop('cards')).toBe(dummyCardArray) });