Skip to content

Commit

Permalink
fix: fix unmount on stories tests [no issue] (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau authored Sep 14, 2023
1 parent 3f1804c commit 1180622
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ exports.storiesOf = (groupName) => {
const rtlApi = render(story(context), { wrapper: WrappingComponent });
if (waitForExpectation) await waitFor(() => waitForExpectation(rtlApi, expect, { parameters }));
expect(rtlApi.toJSON()).toMatchSnapshot();
rtlApi.unmount();
});
});

Expand Down
4 changes: 2 additions & 2 deletions @ornikar/jest-config-react/__mocks__/@storybook/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ exports.storiesOf = (groupName) => {
: ({ children }) => decorateStory(() => children, [...localDecorators, ...globalDecorators])(context);

const rtlApi = render(story(context), { wrapper: wrappingComponent });
const { asFragment } = rtlApi;
if (waitForExpectation) {
await waitFor(() => waitForExpectation(rtlApi, expect, { parameters }));
}
expect(asFragment()).toMatchSnapshot();
expect(rtlApi.asFragment()).toMatchSnapshot();
rtlApi.unmount();
});
});

Expand Down

0 comments on commit 1180622

Please sign in to comment.