Add more query building tests