Diabetes in pregnancy

I’m 20 weeks pregnant and everyone says if you have gestational diabetes you can’t have lots of sugar and things that like but you don’t get a glucose test till around 24-27 weeks so I’m confused what if I constantly eat sugar then find out I have gd at 27 weeks what’s the point in stopping if you’ve been having sugar up till u find out