Moved intial filtering to a scope function and added test

This commit is contained in:
TheHollidayInn
2015-09-24 16:39:53 -05:00
parent 43c9683a8b
commit bfca612be2
2 changed files with 29 additions and 11 deletions

View File

@@ -148,6 +148,19 @@ describe('Challenges Controller', function() {
expect(scope.filterChallenges(notOwnMem)).to.eql(false);
expect(scope.filterChallenges(notOwnNotMem)).to.eql(true);
});
it('it filters challenges to a single group when group id filter is set', inject(function($controller) {
scope.search = { };
scope.groups = {
0: specHelper.newGroup({_id: 'group-one'}),
1: specHelper.newGroup({_id: 'group-two'}),
2: specHelper.newGroup({_id: 'group-three'})
};
scope.groupIdFilter = 'group-one';
scope.filterInitialChallenges();
expect(scope.search.group).to.eql({'group-one': true});
}));
});
describe('selectAll', function() {