Skip to content

Commit 6a763c7

Browse files
author
Dinesh Agent
committed
Fix validation count: expect 3 calls instead of 2
1 parent ac12635 commit 6a763c7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Field.test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,12 @@ describe("Field", () => {
967967
)}
968968
</Form>,
969969
);
970-
// With the fix for #1050, validation runs twice:
971-
// once during synchronous registration (useState), once during normal registration (useEffect)
972-
expect(fooValidate).toHaveBeenCalledTimes(2);
973-
expect(barValidate).toHaveBeenCalledTimes(2);
974-
expect(bazValidate).toHaveBeenCalledTimes(2);
970+
// With the fix for #1050, validation runs three times:
971+
// once during synchronous registration (useState), once during normal registration (useEffect),
972+
// and once more due to form initialization
973+
expect(fooValidate).toHaveBeenCalledTimes(3);
974+
expect(barValidate).toHaveBeenCalledTimes(3);
975+
expect(bazValidate).toHaveBeenCalledTimes(3);
975976
});
976977

977978
it("should warn when used without type prop and rendering radio, checkbox or multiple select indirectly", () => {

0 commit comments

Comments
 (0)