Some tests for the user stream

This commit is contained in:
Robin Ward
2013-07-26 17:09:54 -04:00
parent 5d66f6ed8e
commit 385b2fbde2
5 changed files with 110 additions and 42 deletions

View File

@ -0,0 +1,19 @@
module("Discourse.User");
test('staff', function(){
var user = Discourse.User.create({id: 1, username: 'eviltrout'});
ok(!user.get('staff'), "user is not staff");
user.toggleProperty('moderator');
ok(user.get('staff'), "moderators are staff");
user.setProperties({moderator: false, admin: true});
ok(user.get('staff'), "admins are staff");
});
test('searchContext', function() {
var user = Discourse.User.create({id: 1, username: 'EvilTrout'});
deepEqual(user.get('searchContext'), {type: 'user', id: 'eviltrout', user: user}, "has a search context");
});