Add tests for querying