Commit 4ce98b19 authored by Robert Knight's avatar Robert Knight

Add missing tests for GROUPS_CHANGED and USER_CHANGED events

parent 398f73a2
......@@ -158,7 +158,7 @@ describe('h:session', function () {
});
describe('#update()', function () {
it('broadcasts an event when the session is updated', function () {
it('broadcasts SESION_CHANGED when the session changes', function () {
var sessionChangeCallback = sinon.stub();
// the initial load should trigger a SESSION_CHANGED event
......@@ -184,5 +184,27 @@ describe('h:session', function () {
assert.calledWith(sessionChangeCallback, sinon.match({}),
{initialLoad: false});
});
it('broadcasts GROUPS_CHANGED when the groups change', function () {
var groupChangeCallback = sinon.stub();
$rootScope.$on(events.GROUPS_CHANGED, groupChangeCallback);
session.update({
groups: [{
id: 'groupid'
}],
csrf: 'dummytoken'
});
assert.calledOnce(groupChangeCallback);
});
it('broadcasts USER_CHANGED when the user changes', function () {
var userChangeCallback = sinon.stub();
$rootScope.$on(events.USER_CHANGED, userChangeCallback);
session.update({
userid: 'fred',
csrf: 'dummytoken'
});
assert.calledOnce(userChangeCallback);
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment