Files
habitica/test/spec/rootCtrlSpec.js
Kevin Gisi 1e59336d09 Repair remaining Karma specs - all passing.
* Stubbed out User module to repair rootCtrlSpec

* Loaded RootCtrl in inventoryCtrlSpec, as it was missing shared functions.
  Updated mock user to include a mounts hash.
2015-03-24 21:39:03 -04:00

39 lines
1.6 KiB
JavaScript

'use strict';
// @TODO: Something here is calling a full page reload
describe('Root Controller', function() {
var scope, user, ctrl;
beforeEach(function () {
module(function($provide) {
$provide.value('User', {});
});
inject(function($rootScope, $controller) {
scope = $rootScope.$new();
scope.loginUsername = 'user'
scope.loginPassword = 'pass'
user = specHelper.newUser();
ctrl = $controller('RootCtrl', {$scope: scope, User: {user: user}});
});
});
it('shows contributor level text', function(){
expect(scope.contribText()).to.eql(undefined);
expect(scope.contribText(null, {npc: 'NPC'})).to.eql('NPC');
expect(scope.contribText({level: 0, text: 'Blacksmith'})).to.eql(undefined);
expect(scope.contribText({level: 1, text: 'Blacksmith'})).to.eql('Friend Blacksmith');
expect(scope.contribText({level: 2, text: 'Blacksmith'})).to.eql('Friend Blacksmith');
expect(scope.contribText({level: 3, text: 'Blacksmith'})).to.eql('Elite Blacksmith');
expect(scope.contribText({level: 4, text: 'Blacksmith'})).to.eql('Elite Blacksmith');
expect(scope.contribText({level: 5, text: 'Blacksmith'})).to.eql('Champion Blacksmith');
expect(scope.contribText({level: 6, text: 'Blacksmith'})).to.eql('Champion Blacksmith');
expect(scope.contribText({level: 7, text: 'Blacksmith'})).to.eql('Legendary Blacksmith');
expect(scope.contribText({level: 8, text: 'Blacksmith'})).to.eql('Guardian Blacksmith');
expect(scope.contribText({level: 9, text: 'Blacksmith'})).to.eql('Heroic Blacksmith');
expect(scope.contribText({level: 9, text: 'Blacksmith'}, {npc: 'NPC'})).to.eql('NPC');
});
});