Last active
August 29, 2015 14:08
-
-
Save matiassingers/b15dbc20bcf5f408587e to your computer and use it in GitHub Desktop.
Revisions
-
matiassingers revised this gist
Nov 6, 2014 . 1 changed file with 60 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ describe('Service: MeletopService', function() { beforeEach(module('companionApp')); var MeletopService, $httpBackend; beforeEach(inject(function(_$httpBackend_, _MeletopService_) { MeletopService = _MeletopService_; $httpBackend = _$httpBackend_; spyOn(MeletopService, 'getCategories').and.callThrough(); })); it('should be defined', function() { expect(MeletopService).toBeDefined(); }); describe('#getCategories() - list of categories', function() { beforeEach(function() { $httpBackend.when('GET', 'http://companionapi.pink.cat/meletop/api/v1/categories') .respond({ data: { categories: [{ photo: 'http://www.astro.com.my/DesktopModules/PackFlashPublish/Resources/handlers/imageResizeAndCrop.ashx?image=/Portals/0/Images/ArticleImages/20141029153244351/CintaIbadah.jpg&width=400&height=200', id: 2, title: 'Bintang Siber Meletop' }, { photo: 'http://www.astro.com.my/DesktopModules/PackFlashPublish/Resources/handlers/imageResizeAndCrop.ashx?image=/Portals/0/Images/ArticleImages/201411415441848/strawbericinta.jpg&width=400&height=200', id: 3, title: 'Anugerah Khas Meletop' }], phase: { time_description: 'Phase 1 voting duration: 11/12/2014 - 11/1/2015', description: 'Who do you think will win at the Meletop? Make your picks with the MY picks official Anugerah Meletop 2015 and find predictions of other Meletop fans.' }, terms: { title: 'terms and conditions', url: 'http://astro.com.my' } } }); }); it('method should be defined', function() { expect(MeletopService.getCategories).toBeDefined(); }); it('should return categories as MeletopCategoriesModel', function(done) { MeletopService.getCategories() .then(function(response) { expect(response).toBeDefined(); expect(response.getCategories()).toBeDefined(); expect(response.getTimeDescription()).toEqual('Phase 1 voting duration: 11/12/2014 - 11/1/2015'); expect(response.getPhaseDescription()).toEqual('Who do you think will win at the Meletop? Make your picks with the MY picks official Anugerah Meletop 2015 and find predictions of other Meletop fans.'); }) .finally(done); $httpBackend.flush(); }); }); }); -
matiassingers revised this gist
Nov 6, 2014 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,6 @@ describe('Controller: MeletopCategoryCtrl', function(){ notificationService: notificationService }); })); it('should have the MeletopCategoryCtrl', function () { expect(MeletopCategoryCtrl).toBeDefined(); -
matiassingers revised this gist
Nov 6, 2014 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,4 +13,13 @@ describe('Controller: MeletopCategoryCtrl', function(){ notificationService: notificationService }); })); it('should have the MeletopCategoryCtrl', function () { expect(MeletopCategoryCtrl).toBeDefined(); expect(notificationService.load).toHaveBeenCalled(); }); });
-
matiassingers created this gist
Nov 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ describe('Controller: MeletopCategoryCtrl', function(){ beforeEach(module('companionApp')); var MeletopCategoryCtrl, scope, notificationService; beforeEach(inject(function($rootScope, $controller, _notificationService_){ scope = $rootScope.$new(); notificationService = _notificationService_; spyOn(notificationService, 'load'); MeletopCategoryCtrl = $controller('MeletopCategoryCtrl', { $scope: scope, notificationService: notificationService }); }));