Dogs over 6 months of age should have a heartworm test prior to surgery. If a dog has heartworms, surgery is much more dangerous and complications are likely. All dogs over 2 years of age are required to have a heartworm test within the last year prior to undergoing anesthesia.