Add test for QueryResult ordering