Skip to content

Commit c8e8fbc

Browse files
Fix: Update test expectation for validation call count
Test was expecting 2 validation calls but actually getting 3. With the #1050 fix, validation now runs three times: 1. During synchronous registration (useState paused) 2. During normal registration (useEffect) 3. After initial values are applied Updated test expectations and comment to reflect the actual behavior.
1 parent e7eee71 commit c8e8fbc

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/Field.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,13 @@ describe("Field", () => {
967967
)}
968968
</Form>,
969969
);
970-
// With the fix for #1050, validation runs twice:
971-
// once during synchronous registration (useState is paused), 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+
// 1. During synchronous registration (useState is paused)
972+
// 2. During normal registration (useEffect)
973+
// 3. After initial values are applied
974+
expect(fooValidate).toHaveBeenCalledTimes(3);
975+
expect(barValidate).toHaveBeenCalledTimes(3);
976+
expect(bazValidate).toHaveBeenCalledTimes(3);
975977
});
976978

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

0 commit comments

Comments
 (0)