redux-auto
redux-auto copied to clipboard
Add another test example to Readme
Would be nice to have an example calling an action
// @ts-ignore: Unreachable code error
import actions from 'redux-auto';
import { render } from '@testing-library/react';
import React, { useEffect } from 'react';
import { connect } from 'react-redux';
jest.unmock('redux-auto');
jest.mock('axios', () => ({
get: ()=> Promuse.resolve({ name: 'tome' }),
}));
const Component = () => {
useEffect(() => {
actions.server.call();
}, []);
return <>tset</>;
};
const mapStateToProps = () => ({});
const WrapperComponent = connect(mapStateToProps)(Component);
describe.only('#foo -> bar', () => {
it('should return the something when calling the server', () => {
render(
<ProviderStoreToTests>
<WrapperComponent />
</ProviderStoreToTests>
);
expect(actions.server.call).toBeCalled();
});
});