Skip to content

Commit

Permalink
temp2
Browse files Browse the repository at this point in the history
  • Loading branch information
daadaadaah committed Jun 29, 2021
1 parent 9d954e8 commit 4a6a5df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/pages/MainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function MainPage() {
};

const handleClick = () => {
// dispatch(fetchPreview());
dispatch(fetchPreview());
};

return (
Expand Down
36 changes: 18 additions & 18 deletions src/pages/MainPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,28 +227,28 @@ describe('<MainPage />', () => {
});
});

// context('when search button is clicked', () => {
// const dispatch = jest.fn();
context('when search button is clicked', () => {
const dispatch = jest.fn();

// beforeEach(() => {
// useCurrentUser.mockImplementation(() => ({
// currentUser,
// }));
beforeEach(() => {
useCurrentUser.mockImplementation(() => ({
currentUser,
}));

// useDispatch.mockImplementation(() => dispatch);
useDispatch.mockImplementation(() => dispatch);

// useSelector.mockImplementation((selector) => selector({
// url: devlink.url,
// preview,
// }));
// });
useSelector.mockImplementation((selector) => selector({
url: devlink.url,
preview,
}));
});

// it('change dispatch', () => {
// const { getByLabelText } = render(<MainPage />);
it('change dispatch', () => {
const { getByLabelText } = render(<MainPage />);

// fireEvent.click(getByLabelText('search-url'));
fireEvent.click(getByLabelText('search-url'));

// expect(dispatch).toBeCalledTimes(1);
// });
// });
expect(dispatch).toBeCalledTimes(1);
});
});
});

0 comments on commit 4a6a5df

Please sign in to comment.