Add tests for query and conditions