"Wrong" tests don't get discounted from the bill, for good or for bad. But in fact they did do what they were supposed to do, which is to figure out if you were having a heart attack and, if you were, do all necessary things to try to save your life. In emergency-room situations, they go for the worst-case scenario first, because it's urgent to know whether there's a life-threatening situation. So they determined that there wasn't. That was your good luck, of course, although it doesn't seem like it. It's unfortunate that they didn't figure out that the rib was the problem. But they did figure out that you weren't in danger of dying from a heart attack. Once that was clear, the diagnosis became much less urgent. I'm sure it hurt, but it wasn't going to kill you.
If this exact thing happens again, you may be fine going to a chiropractor to get it checked out. (Or by telling the emergency room docs that your rib goes out of place and produces these symptoms.) I used to share a house with an emergency room nurse, though, and she had some tragic stories of people who arrived too late at the ER because they thought they'd just get their possible-heart-attack symptoms checked out a cheaper way first. I'm sure it's often the case that people have saved money that way and found they had minor ailments. But for the ones who were having an actual heart attack, that path could be fatal. Men in particular, as a gender, are famous in the medical world for trying to tough it out, also known as "dying."