11import configureMockStore from 'redux-mock-store'
22import thunk from 'redux-thunk'
3- import { actions , addBoardEstimations , receiveBoards , requestBoards } from '../'
3+ import { actions , addBoardEstimations , receiveBoards , requestBoards , resetBoards } from '../'
44
55// some static mocks
66import {
@@ -13,6 +13,7 @@ jest.mock('../../../data/trello')
1313
1414describe ( 'actions/board' , ( ) => {
1515 const expectedActions = {
16+ RESET_BOARDS : 'RESET_BOARDS' ,
1617 REQUEST : 'REQUEST_BOARDS' ,
1718 RECEIVE : 'RECEIVE_BOARDS' ,
1819 ADD_BOARD_ESTIMATION : 'ADD_BOARD_ESTIMATION' ,
@@ -57,7 +58,7 @@ describe('actions/board:async actions', () => {
5758 jest . unmock ( '../../../data/trello' )
5859 } )
5960
60- it ( 'creates RECEIVE when fetching boards has been done', async ( ) => {
61+ test ( 'dispatches RECEIVE when fetching boards has been done', async ( ) => {
6162 // payload is set in setup-jest.js (config mock)
6263 const expectedActions = [
6364 { type : actions . REQUEST } ,
@@ -76,4 +77,11 @@ describe('actions/board:async actions', () => {
7677 await store . dispatch ( requestBoards ( ) )
7778 expect ( store . getActions ( ) ) . toEqual ( expectedActions )
7879 } )
80+
81+ test ( 'resetBoards should dispatch correct actions' , async ( ) => {
82+ const store = mockStore ( { } )
83+ await store . dispatch ( resetBoards ( ) )
84+ const expectedActions = [ { type : actions . RESET_BOARDS } , { type : actions . REQUEST } ]
85+ expect ( store . getActions ( ) ) . toEqual ( expectedActions )
86+ } )
7987} )
0 commit comments