I think the easiest way to test it is to create an infinite loop based on your assumption and see if actually is an infinite loop. You can also loop until first returned hash is empty which won’t rely on the cursor value at al. (that way you’ll avoid while condition too).
What I did when looping through live streams is I check for a specific viewers_count number because with the current Rate Limit (which is 120 with a Bearer Token) I won’t be able to go through all 30k+ streams every minute. I theoretically could do it with 3 or even 4 separate tokens, but ¯_(ツ)_/¯