Migrated visits-loading actions to payload actions

This commit is contained in:
Alejandro Celaya
2022-11-12 10:33:52 +01:00
parent a6ed0c811d
commit a3cc3d5fc2
15 changed files with 136 additions and 127 deletions

View File

@@ -1,22 +1,9 @@
import { Action } from 'redux';
import { buildActionCreator, buildReducer } from '../../../src/utils/helpers/redux';
import { buildReducer } from '../../../src/utils/helpers/redux';
describe('redux', () => {
beforeEach(jest.clearAllMocks);
describe('buildActionCreator', () => {
it.each([
['foo', { type: 'foo' }],
['bar', { type: 'bar' }],
['something', { type: 'something' }],
])('returns an action creator', (type, expected) => {
const actionCreator = buildActionCreator(type);
expect(actionCreator).toBeInstanceOf(Function);
expect(actionCreator()).toEqual(expected);
});
});
describe('buildReducer', () => {
const fooActionHandler = jest.fn(() => 'foo result');
const barActionHandler = jest.fn(() => 'bar result');