Hey guys, I'm having trouble doing my Jasmine Tests http calls to test my REST API made in Node.JS. This is my first angularApplication ... Could anyone please point out what I'm doing wrong?
My Spec is below and this is the link of my application: https://github.com/diegofss11/contact-list-application/tree/BranchOnTest describe('ContactService - Testing CRUD Operations', function(){ > var myServiceMock, $httpBackend, > BASE_URL = "http://localhost:3000", > mockContacts = [ > { > name: 'Diego Souza', > address: 'Hudson Street', > phone: '553188848176' > }, > { > name: 'Albert Silva', > address: 'Mkt Street', > phone: '1456847585' > } > ]; > > //mock contactListApp > beforeEach(module('contactListApp')) > > beforeEach(inject(function (ContactService, $httpBackend){ > $httpBackendMock = $httpBackend; > myServiceMock = ContactService; > $httpBackendMock.expectGET(BASE_URL + '/contacts/').respond( > {"Success": true,"ErrorMessage": "","Result":[mockContacts]}); > spyOn(myServiceMock, 'findAll').andCallThrough(); // Calling of > the 'findAll' method is ensured > })); > > it('should find all the contacts', function(){ > expect(myServiceMock.findAll).toHaveBeenCalled(); > $httpBackendMock.flush(); > }) > }) Thank you so much all !!! -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
