Gestational diabetes?

At my next appointment I’ll be doing my gestational diabetes test. For anyone who’s had it, is it brought on by diet? Or is it caused by something else?

I’m worried because this pregnancy I’ve had such a sweet tooth! I eat applesauce almost daily, plus apple juice. I also order McDonald’s almost once a week and get a hamburger and a hot fudge sundae. Usually I love salads, avocados, almonds, pomegranates and everything healthy, but this baby is bringing me back to my unhealthy college cravings. I’m still technically underweight and I’ve only gained about 15lb, but I’m just worried about my pregnancy diet/cravings possibly causing GD.