easy-peasy
Version:
Vegetarian friendly state for React
25 lines (21 loc) • 483 B
JavaScript
import { createStore, thunk } from '../index';
test('exposes dependencies to effect actions', async () => {
// arrange
const injection = jest.fn();
const store = createStore(
{
doSomething: thunk((actions, payload, { injections }) => {
injections.injection();
}),
},
{
injections: {
injection,
},
},
);
// act
await store.getActions().doSomething();
// assert
expect(injection).toHaveBeenCalledTimes(1);
});