mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Add failing test, seeking help/advice
This commit is contained in:
37
test/client-old/spec/controllers/userCtrlSpec.js
Normal file
37
test/client-old/spec/controllers/userCtrlSpec.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('User Controller', function() {
|
||||||
|
var $rootScope, shared, scope, user, User, ctrl, content;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
user = specHelper.newUser();
|
||||||
|
User = {
|
||||||
|
user: user
|
||||||
|
};
|
||||||
|
|
||||||
|
module(function($provide) {
|
||||||
|
$provide.value('User', User);
|
||||||
|
$provide.value('Guide', {});
|
||||||
|
});
|
||||||
|
|
||||||
|
inject(function($rootScope, $controller, Shared, Content){
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
Shared.wrap(user);
|
||||||
|
shared = Shared;
|
||||||
|
content = Content
|
||||||
|
$controller('RootCtrl', {$scope: scope, User: User, Shared: Shared});
|
||||||
|
ctrl = $controller('UserCtrl', {$scope: scope, User: User});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe.only('getProgressDisplay', function() {
|
||||||
|
it('should return initial progress', function() {
|
||||||
|
sinon.stub(content, 'loginIncentives').onFirstCall().returns({
|
||||||
|
prevRewardKey: 0,
|
||||||
|
nextRewardKey: 1
|
||||||
|
});
|
||||||
|
var actual = scope.getProgressDisplay();
|
||||||
|
expect(actual).to.eql('');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$http', '$state', 'Guide', 'Shared', 'Content', 'Stats', 'Social', 'Costume',
|
habitrpg.controller('UserCtrl', ['$rootScope', '$scope', '$location', 'User', '$http', '$state', 'Guide', 'Shared', 'Content', 'Stats', 'Social', 'Costume',
|
||||||
function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats, Social, Costume) {
|
function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats, Social, Costume) {
|
||||||
$scope.profile = User.user;
|
$scope.profile = User.user;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user