Macs can last a long time. Usually what goes is the HDD, which is replaceable. If you're waiting for it to fail, so you can get a new iMac, it will NEVER die. I still have a Mac Pro, 1,1 that's going strong. A G-5 Powermac Tower that still runs fine, but don't use. An old Sawtooth G-4, that runs fine but I no longer use. A G-4 MDD tower that I gave to my sister and she's still using it. A G-3 desktop that still runs if I'd put a HDD in it. And an old Mac II ci from around 1990 that ran last time I started it. However, I haven't run that one for many years, now.
Mac's rarely die... especially if you're waiting for it to. If I waited until my first Mac died before I bought another, I'd still be using the Mac II ci.