title: Optional file validation with Formik/Yup
body: <p>I want to validate file input if a file is selected, I found the solution for Formik/Yup but it validates even if file is not selected.</p>
  
  <pre><code>avatar: Yup.mixed()
      .test("fileSize", "File is too large", value =&gt; {
        return value &amp;&amp; value.size &lt;= FILE_SIZE;
      })
      .test(
        "fileFormat",
        "Unsupported Format",
        value =&gt; value &amp;&amp; SUPPORTED_FORMATS.includes(value.type)
      )
  </code></pre>
  
  <p>It triggers validation when I type in other inputs, I want to trigger it only if file is there since avatar is optional!</p>