Support Aggrregate
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' } }]);
});
});