There are two ways of knowing - 1) You play content in 4K HDR according to the TV (most TVs can show the resolution of the content being shown) and it looks good with no artifacts or issues, or 2) Ensure the packaging clearly states the cable inside is 100% compliant with 4K HDR.
From the article linked to in a previous post that backs what I’ve been saying:
If you're the type of person that doesn't want to think about it, and doesn't mind spending slightly more, consider Premium Certified HDMI cables. They cost slightly more than non-certified, but they're tested to work with the heavy bandwidth required of 4K HDR content. The difference in price isn't massive. You can still get cheap HDMI cables that are Premium Certified, they're just not quite as cheap as the cheapest options. You don't need to buy these, mind you, but if you just want to buy one thing and not think about it, that's your best option.