tests for reduce and group queries