Add integration test for sort query