mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +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,14 +1,17 @@
|
||||
'use strict';
|
||||
// @TODO Address why translations aren't loading
|
||||
// Possibly related to https://github.com/HabitRPG/habitrpg/commit/5aa401524934e6d9071f13cb2ccca0dba13cdcff
|
||||
|
||||
describe('Inventory Controller', function() {
|
||||
var scope, ctrl, user, $rootScope;
|
||||
|
||||
beforeEach(inject(function($rootScope, $controller, Shared){
|
||||
beforeEach(function() {
|
||||
module(function($provide) {
|
||||
$provide.value('User', {});
|
||||
});
|
||||
|
||||
inject(function($rootScope, $controller, Shared){
|
||||
user = specHelper.newUser();
|
||||
user.balance = 4,
|
||||
user.items = {eggs: {Cactus: 1}, hatchingPotions: {Base: 1}, food: {Meat: 1}, pets: {}};
|
||||
user.items = {eggs: {Cactus: 1}, hatchingPotions: {Base: 1}, food: {Meat: 1}, pets: {}, mounts: {}};
|
||||
Shared.wrap(user);
|
||||
var mockWindow = {
|
||||
confirm: function(msg){
|
||||
@@ -16,8 +19,13 @@ describe('Inventory Controller', function() {
|
||||
}
|
||||
};
|
||||
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(){
|
||||
expect(scope.selectedEgg).to.eql(null);
|
||||
@@ -35,7 +43,7 @@ describe('Inventory Controller', function() {
|
||||
expect(scope.selectedPotion.key).to.eql('Base');
|
||||
});
|
||||
|
||||
xit('hatches a pet', function(){
|
||||
it('hatches a pet', function(){
|
||||
scope.chooseEgg('Cactus');
|
||||
scope.choosePotion('Base');
|
||||
expect(user.items.eggs).to.eql({Cactus: 0});
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
// @TODO: Something here is calling a full page reload
|
||||
xdescribe('Root Controller', function() {
|
||||
describe('Root Controller', function() {
|
||||
var scope, user, ctrl;
|
||||
|
||||
beforeEach(inject(function($rootScope, $controller) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user