mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 11:36:45 +00: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
20 lines
397 B
JavaScript
20 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();
|
|
}
|