Currently I want to test if this action is being called, and the reason is because this action only empty the array. So in order to test this action function I want to check if this is being called once. So I was thinking of using toHaveBeenCalled(1). Not sure if this is the right one to use that in here.
import * as actions from '../actions/index';
import { types } from '../actions/index';
import { fixedApi } from '../mock/mockAPI';
describe('actions', () => {
it('should create an action and check if action named clearArray is being called', () => {
const expectedAction = {
type: types.CLEAR_ARRAY
}
expect(actions.clearArray()).toHaveBeenCalled()
});
})
Aucun commentaire:
Enregistrer un commentaire