From ae080fd474e77b0660207a487fe5c51cf322320e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jureti=C4=87?= Date: Thu, 2 Jan 2014 22:49:31 -0300 Subject: [PATCH] Tests for inventoryCtrl --- test/spec/inventoryCtrlSpec.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/spec/inventoryCtrlSpec.js diff --git a/test/spec/inventoryCtrlSpec.js b/test/spec/inventoryCtrlSpec.js new file mode 100644 index 0000000000..a2551f841b --- /dev/null +++ b/test/spec/inventoryCtrlSpec.js @@ -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'); + }); +});