mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
Tests for inventoryCtrl
This commit is contained in:
parent
e6e922d00a
commit
ae080fd474
1 changed files with 29 additions and 0 deletions
29
test/spec/inventoryCtrlSpec.js
Normal file
29
test/spec/inventoryCtrlSpec.js
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('Inventory Controller', function() {
|
||||||
|
var scope, ctrl;
|
||||||
|
|
||||||
|
beforeEach(module('habitrpg'));
|
||||||
|
beforeEach(inject(function($rootScope, $controller){
|
||||||
|
var user = {};
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
$rootScope.Content = window.habitrpgShared.content;
|
||||||
|
ctrl = $controller('InventoryCtrl', {$scope: scope, User: user});
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('starts without any item selected', function(){
|
||||||
|
expect(scope.selectedEgg).to.eql(null);
|
||||||
|
expect(scope.selectedPotion).to.eql(null);
|
||||||
|
expect(scope.selectedFood).to.eql(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('chooses an egg', function(){
|
||||||
|
scope.chooseEgg('Cactus');
|
||||||
|
expect(scope.selectedEgg.key).to.eql('Cactus');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('chooses a potion', function(){
|
||||||
|
scope.choosePotion('Base');
|
||||||
|
expect(scope.selectedPotion.key).to.eql('Base');
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue