Skip to content

Commit 2f75e5d

Browse files
committed
test: Update coverage
1 parent a712622 commit 2f75e5d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/validate-warning.test.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ import { mount } from 'enzyme';
44
import Form from '../src';
55
import InfoField, { Input } from './common/InfoField';
66
import { changeValue, matchError } from './common';
7-
import type { Rule } from '@/interface';
7+
import type { FormInstance, Rule } from '../src/interface';
88

99
describe('Form.WarningValidate', () => {
1010
it('required', async () => {
11+
let form: FormInstance<any>;
12+
1113
const wrapper = mount(
12-
<Form>
14+
<Form
15+
ref={f => {
16+
form = f;
17+
}}
18+
>
1319
<InfoField
1420
name="name"
1521
rules={[
@@ -26,6 +32,7 @@ describe('Form.WarningValidate', () => {
2632

2733
await changeValue(wrapper, '');
2834
matchError(wrapper, false, "'name' is required");
35+
expect(form.getFieldWarning('name')).toEqual(["'name' is required"]);
2936
});
3037

3138
describe('validateFirst should not block error', () => {

0 commit comments

Comments
 (0)