From 9cbacd148e08488942a3da51b1b75669b55a7f52 Mon Sep 17 00:00:00 2001
From: lijianan <574980606@qq.com>
Date: Fri, 4 Nov 2022 11:20:53 +0800
Subject: [PATCH] test: add unmount for test case (#38373)
---
components/locale-provider/__tests__/cached-context.test.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/components/locale-provider/__tests__/cached-context.test.tsx b/components/locale-provider/__tests__/cached-context.test.tsx
index 64bb9a8851..c9a9406e66 100644
--- a/components/locale-provider/__tests__/cached-context.test.tsx
+++ b/components/locale-provider/__tests__/cached-context.test.tsx
@@ -28,11 +28,13 @@ const CacheOuter: React.FC = memo(() => (
>
));
+
it("Rendering on LocaleProvider won't trigger rendering on child component.", () => {
- const { container } = pureRender();
+ const { container, unmount } = pureRender();
expect(outerCount).toBe(0);
expect(innerCount).toBe(1);
fireEvent.click(container.querySelector('#parent_btn')!);
expect(outerCount).toBe(1);
expect(innerCount).toBe(1);
+ unmount();
});