Clear the session-user cache when changing _User objects

This commit is contained in:
Fosco Marotto
2016-03-17 02:06:26 -07:00
parent 40812e2f53
commit 877d29daf8
2 changed files with 28 additions and 1 deletions

View File

@@ -2050,5 +2050,27 @@ describe('Parse.User testing', () => {
Parse.Cloud._removeHook('Triggers', 'afterSave', '_User');
done();
});
})
});
it('changes to a user should update the cache', (done) => {
Parse.Cloud.define('testUpdatedUser', (req, res) => {
expect(req.user.get('han')).toEqual('solo');
res.success({});
});
let user = new Parse.User();
user.setUsername('harrison');
user.setPassword('ford');
user.signUp().then(() => {
user.set('han', 'solo');
return user.save();
}).then(() => {
return Parse.Cloud.run('testUpdatedUser');
}).then(() => {
done();
}, (e) => {
fail('Should not have failed.');
done();
});
});
});