mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Add route to add a hourglass
This commit is contained in:
@@ -583,4 +583,35 @@ describe('User Controller', function() {
|
||||
expect(res.send).to.be.calledWith(204);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#addHourglass', function() {
|
||||
var req, res, user;
|
||||
|
||||
beforeEach(function() {
|
||||
user = {
|
||||
_id: 'user-id',
|
||||
purchased: { plan: { consecutive: { trinkets: 3 } } },
|
||||
save: sinon.stub().yields()
|
||||
};
|
||||
req = { };
|
||||
res = {
|
||||
locals: { user: user },
|
||||
send: sinon.spy()
|
||||
};
|
||||
});
|
||||
|
||||
it('adds an hourglass to user', function() {
|
||||
userController.addHourglass(req, res);
|
||||
|
||||
expect(user.purchased.plan.consecutive.trinkets).to.eql(4);
|
||||
expect(user.save).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('sends back 204', function() {
|
||||
userController.addHourglass(req, res);
|
||||
|
||||
expect(res.send).to.be.calledOnce;
|
||||
expect(res.send).to.be.calledWith(204);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user