Skip to content

Commit 13c2e69

Browse files
author
zhangningning
committed
chore: 🔧 更新测试文件,引入 useEffect 和 Form 组件
1 parent c09513f commit 13c2e69

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/hooks/src/useAntdTable/__tests__/index.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { act, renderHook, waitFor } from '@testing-library/react';
22
import { sleep } from '../../utils/testingHelpers';
33
import useAntdTable from '../index';
4+
import { useEffect } from 'react';
5+
import { Form } from 'antd';
46

57
interface Query {
68
current: number;
@@ -23,7 +25,7 @@ describe('useAntdTable', () => {
2325

2426
let searchType = 'simple';
2527

26-
const form: any = {
28+
const form = {
2729
getInternalHooks: () => {},
2830
initialValue: {
2931
name: 'default name',
@@ -348,10 +350,10 @@ describe('useAntdTable', () => {
348350
});
349351
});
350352

351-
it("should defaultParams work with manual is true", async () => {
353+
it('should defaultParams work with manual is true', async () => {
352354
queryArgs = undefined;
353355
form.resetFields();
354-
changeSearchType("advance");
356+
changeSearchType('advance');
355357

356358
act(() => {
357359
renderHook((o) => {
@@ -366,15 +368,15 @@ describe('useAntdTable', () => {
366368
current: 2,
367369
pageSize: 10,
368370
},
369-
{ name: "hello", phone: "123" },
371+
{ name: 'hello', phone: '123' },
370372
],
371-
defaultType: "advance",
372-
}
373+
defaultType: 'advance',
374+
},
373375
);
374376

375377
useEffect(() => {
376378
// defaultParams works
377-
expect(myForm.getFieldValue("name")).toBe("hello");
379+
expect(myForm.getFieldValue('name')).toBe('hello');
378380
expect(queryArgs).toBe(undefined);
379381
}, []);
380382
});

0 commit comments

Comments
 (0)