[queryDepartures] Compute number of departures to add.
Add test for queryDepartures.