Skip to content

Instantly share code, notes, and snippets.

View eltongarbin's full-sized avatar
🎯
Focusing

Elton Garbin eltongarbin

🎯
Focusing
  • Maringá, Brazil
View GitHub Profile
@eltongarbin
eltongarbin / test-utils.js
Created September 22, 2021 01:32
Custom render method that includes things like global context providers, data stores, etc.
import React from 'react';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
const mockStore = configureStore([thunk]);
@eltongarbin
eltongarbin / Component.js
Created January 30, 2019 10:29
Factory to create redux async actions and types
import { actions } from 'ducks.js';
// etc.......
const mapDispatchToProps = {
fetchTodos: actions.fetchTodos.request // <---------
}
// etc.......
import { actions } from 'ducks.js';
// etc.......
const mapDispatchToProps = {
fetchTodos: actions.fetchTodos.request // <---------
}
// etc.......