Skip to content

Support Aggrregate

Compare
Choose a tag to compare
@alonronin alonronin released this 22 May 17:11
· 86 commits to master since this release

Now you can mock the Aggregate framework:

it('should aggregate with promise', () => {
  mockingoose.User.toReturn([{ _id: { accountId: '5aef17c3d7c488f401c101bd' } }], 'aggregate');

  return User
    .aggregate(
      [{
        '$group': {
          '_id': {
            'accountId': '$accountId'
          }
        }
      }])
    .then(result => {
      expect(result).toEqual([{ _id: { accountId: '5aef17c3d7c488f401c101bd' } }]);
    });
});