That's one of the many things to check before taking delivery. Unfortunately (and I was one of them) many people don't know to verify everything is working when buying a trailer. A decent dealer would have tried it and caught it before you came to look at it but, well, some just aren't decent. Most likely a factory defect if it hasn't worked from day one unless you tried to run it without it being somewhat level. That COULD screw it up I guess, although I don't have any personal experience with having one die.
Now, as to leaving it for repair, they'll probably have to look at it and then order parts. Here again, depends on how decent the dealership is as to how prompt they are with the ordering. Also has to do with how much and what type of work they're doing. You may consider having them look at it, then order what they need and let you know when it comes in so you don't have to leave it.
2012 Chevy Tahoe LTZ - HD tow package
2017 Rockwood 2703WS Emerald Edition