mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-10-28 03:32:29 +01:00
* Allow gems to be gifted through IAPs * implement non recurring IAP subscriptions * fix localization issue in error * fix non renewing subscription handling * Fix lint error * fix tests * move findbyId mock to helper file * undo package-lock changes * Fix lint error
21 lines
397 B
JavaScript
21 lines
397 B
JavaScript
import mongoose from 'mongoose';
|
|
|
|
export async function mockFindById (response) {
|
|
const mockFind = {
|
|
select () {
|
|
return this;
|
|
},
|
|
lean () {
|
|
return this;
|
|
},
|
|
exec () {
|
|
return Promise.resolve(response);
|
|
},
|
|
};
|
|
sinon.stub(mongoose.Model, 'findById').returns(mockFind);
|
|
}
|
|
|
|
export function restoreFindById () {
|
|
return mongoose.Model.findById.restore();
|
|
}
|