# Note that the expected behavior (these should be arrays, not
# streams), is opposite of the title of the issue on github. We
# arrived at the expected behavior after some debate, hence the
# difference.
desc: Regression tests for issue #125, aggregation ops should be of type array, not stream
tests:
    
    # Set up a stream
    - cd: r.db('test').table_create('t125')
      def: t = r.db('test').table('t125')

    - cd: t.insert([{'id':0,'a':10}, {'id':1,'a':20}])

    # Note: we only check types in one language because it's an
    # entirely server-side operation

    # Type of group_by
    - cd: []
      py: t.group_by('a', r.count).type_of()
      ot: ('ARRAY')

    # Type of gmr
    - cd: []
      py: t.grouped_map_reduce(lambda row:1, r.row['a'], lambda a,b:a + b).type_of()
      ot: ('ARRAY')

    # clean up
    - cd: r.db('test').table_drop('t125')
