Refatoring JS and Testing the method: validateQuantityOfPatches