* add tests for beastMaster, mountMaster, and triadBingo achievements * add tests for challengeWon, streak, ultimateGear, rebirth, and contributor achievements * add achievement service that has openModal function * achievement test pass again * fix indentation, rename openModal to more descriptive displayAchievement * add unit tests for achievements service * initialize user.preferences.suppressModals in specHelper.newUser * update achievement tests to account for new notification service * add new achievementServices file to manifest.json * fix tests * award wonChallenge achiev like other achievs * differentiate between small and normal achiev modals * refactor achievementService.displayAchievement() to take options param
This commit is contained in:
committed by
Blade Barringer
parent
31a1a14bae
commit
a3f83b9076
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
describe('achievementServices', function() {
|
||||
var achievementService, rootScope;
|
||||
|
||||
beforeEach(function() {
|
||||
rootScope = { 'openModal': sandbox.stub() };
|
||||
module(function($provide) {
|
||||
$provide.value('$rootScope', rootScope);
|
||||
});
|
||||
|
||||
inject(function(Achievement) {
|
||||
achievementService = Achievement;
|
||||
});
|
||||
});
|
||||
|
||||
describe('#displayAchievement', function() {
|
||||
it('passes given achievement name to openModal', function() {
|
||||
achievementService.displayAchievement('beastMaster');
|
||||
|
||||
expect(rootScope.openModal).to.be.calledOnce;
|
||||
expect(rootScope.openModal).to.be.calledWith('achievements/beastMaster');
|
||||
});
|
||||
|
||||
it('calls openModal with UserCtrl and small modal size if no other size is given', function() {
|
||||
achievementService.displayAchievement('test');
|
||||
|
||||
expect(rootScope.openModal).to.be.calledOnce;
|
||||
expect(rootScope.openModal).to.be.calledWith(
|
||||
'achievements/test',
|
||||
{ controller: 'UserCtrl', size: 'sm' }
|
||||
);
|
||||
});
|
||||
|
||||
it('calls openModal with UserCtrl and specified modal size if one is given', function() {
|
||||
achievementService.displayAchievement('test', {size: 'md'});
|
||||
|
||||
expect(rootScope.openModal).to.be.calledOnce;
|
||||
expect(rootScope.openModal).to.be.calledWith(
|
||||
'achievements/test',
|
||||
{ controller: 'UserCtrl', size: 'md' }
|
||||
);
|
||||
});
|
||||
|
||||
it('calls openModal with UserCtrl and default \'sm\' size if invalid size is given', function() {
|
||||
achievementService.displayAchievement('test', {size: 'INVALID_SIZE'});
|
||||
|
||||
expect(rootScope.openModal).to.be.calledOnce;
|
||||
expect(rootScope.openModal).to.be.calledWith(
|
||||
'achievements/test',
|
||||
{ controller: 'UserCtrl', size: 'sm' }
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user