Commit 62eec3db authored by mikamboo's avatar mikamboo
Browse files

TG-61 done : Ionic fix broken units-tests

parent 367c912d
......@@ -42,7 +42,8 @@ describe('ShopDetailController', function () {
addFavorite: jasmine.createSpy('addFavorite-spy')
.and.returnValue(deferredAddFav.promise),
removeFavorite: jasmine.createSpy('rmFavorite-spy')
.and.returnValue(deferredRemFav.promise)
.and.returnValue(deferredRemFav.promise),
isFavorite: jasmine.createSpy('isFavorite-spy')
};
// Mock ShopService
......@@ -84,21 +85,26 @@ describe('ShopDetailController', function () {
* ********************************
*/
describe('#load_shop_details', function () {
var shopId = 132;
// Call loadMore on the controller for every test
beforeEach(function() {
shopServiceMock.findById(1);
shopServiceMock.findById(shopId);
shopServiceMock.isFavorite(shopId);
});
it('should call findById on ShopService', function() {
expect(shopServiceMock.findById).toHaveBeenCalledWith(1);
expect(shopServiceMock.findById).toHaveBeenCalledWith(shopId);
});
it('should call isFavorite on ShopService to get shop status ', function(){
expect(shopServiceMock.isFavorite).toHaveBeenCalledWith(shopId);
});
describe('when the findBy is executed,', function() {
it('if success : should init the shop into scope', function (){
deferredShop.resolve({name:'test 1'});
$rootScope.$digest();
//expect($scope.shop).toEqual(jasmine.any(Object));
expect($scope.shop.name).toBe('test 1');
});
......
......@@ -2,7 +2,7 @@ angular
.module('appbase.shop')
.controller('ShopDetailCtrl',
function($scope, $stateParams, $ionicPopup, $filter,
ShopService, AuthService, LoaderService, LocalStorage, MessageService){
ShopService, AuthService, LoaderService, MessageService){
//-- Current shop Id (from navigation)
$scope.shopId = $stateParams.shopId;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment