Browse Source

test: add unmount for test case (#38373)

pull/38367/head
lijianan 2 years ago
committed by GitHub
parent
commit
9cbacd148e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/locale-provider/__tests__/cached-context.test.tsx

4
components/locale-provider/__tests__/cached-context.test.tsx

@ -28,11 +28,13 @@ const CacheOuter: React.FC = memo(() => (
</LocaleProvider>
</>
));
it("Rendering on LocaleProvider won't trigger rendering on child component.", () => {
const { container } = pureRender(<CacheOuter />);
const { container, unmount } = pureRender(<CacheOuter />);
expect(outerCount).toBe(0);
expect(innerCount).toBe(1);
fireEvent.click(container.querySelector('#parent_btn')!);
expect(outerCount).toBe(1);
expect(innerCount).toBe(1);
unmount();
});

Loading…
Cancel
Save