mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
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.
This commit is contained in:
@@ -1,23 +1,31 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// @TODO Address why translations aren't loading
|
|
||||||
// Possibly related to https://github.com/HabitRPG/habitrpg/commit/5aa401524934e6d9071f13cb2ccca0dba13cdcff
|
|
||||||
|
|
||||||
describe('Inventory Controller', function() {
|
describe('Inventory Controller', function() {
|
||||||
var scope, ctrl, user, $rootScope;
|
var scope, ctrl, user, $rootScope;
|
||||||
|
|
||||||
beforeEach(inject(function($rootScope, $controller, Shared){
|
beforeEach(function() {
|
||||||
user = specHelper.newUser();
|
module(function($provide) {
|
||||||
user.balance = 4,
|
$provide.value('User', {});
|
||||||
user.items = {eggs: {Cactus: 1}, hatchingPotions: {Base: 1}, food: {Meat: 1}, pets: {}};
|
});
|
||||||
Shared.wrap(user);
|
|
||||||
var mockWindow = {
|
inject(function($rootScope, $controller, Shared){
|
||||||
confirm: function(msg){
|
user = specHelper.newUser();
|
||||||
return true;
|
user.balance = 4,
|
||||||
}
|
user.items = {eggs: {Cactus: 1}, hatchingPotions: {Base: 1}, food: {Meat: 1}, pets: {}, mounts: {}};
|
||||||
};
|
Shared.wrap(user);
|
||||||
scope = $rootScope.$new();
|
var mockWindow = {
|
||||||
ctrl = $controller('InventoryCtrl', {$scope: scope, User: {user: user}, $window: mockWindow});
|
confirm: function(msg){
|
||||||
}));
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
|
||||||
|
// Load RootCtrl to ensure shared behaviors are loaded
|
||||||
|
$controller('RootCtrl', {$scope: scope, User: {user: user}, $window: mockWindow});
|
||||||
|
|
||||||
|
ctrl = $controller('InventoryCtrl', {$scope: scope, User: {user: user}, $window: mockWindow});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('starts without any item selected', function(){
|
it('starts without any item selected', function(){
|
||||||
expect(scope.selectedEgg).to.eql(null);
|
expect(scope.selectedEgg).to.eql(null);
|
||||||
@@ -35,7 +43,7 @@ describe('Inventory Controller', function() {
|
|||||||
expect(scope.selectedPotion.key).to.eql('Base');
|
expect(scope.selectedPotion.key).to.eql('Base');
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('hatches a pet', function(){
|
it('hatches a pet', function(){
|
||||||
scope.chooseEgg('Cactus');
|
scope.chooseEgg('Cactus');
|
||||||
scope.choosePotion('Base');
|
scope.choosePotion('Base');
|
||||||
expect(user.items.eggs).to.eql({Cactus: 0});
|
expect(user.items.eggs).to.eql({Cactus: 0});
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// @TODO: Something here is calling a full page reload
|
// @TODO: Something here is calling a full page reload
|
||||||
xdescribe('Root Controller', function() {
|
describe('Root Controller', function() {
|
||||||
var scope, user, ctrl;
|
var scope, user, ctrl;
|
||||||
|
|
||||||
beforeEach(inject(function($rootScope, $controller) {
|
beforeEach(function () {
|
||||||
scope = $rootScope.$new();
|
module(function($provide) {
|
||||||
scope.loginUsername = 'user'
|
$provide.value('User', {});
|
||||||
scope.loginPassword = 'pass'
|
});
|
||||||
user = specHelper.newUser();
|
|
||||||
|
|
||||||
ctrl = $controller('RootCtrl', {$scope: scope, User: {user: 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(){
|
it('shows contributor level text', function(){
|
||||||
expect(scope.contribText()).to.eql(undefined);
|
expect(scope.contribText()).to.eql(undefined);
|
||||||
|
|||||||
Reference in New Issue
Block a user