But should not be in the it? Doing individually? What's the difference of using the spyOn and the httpBackEnd ?
On Sunday, May 11, 2014, Tandon, Rishi <[email protected]> wrote: > I mean starting of the beforeEach() method. > > > On Sun, May 11, 2014 at 10:46 AM, Tandon, Rishi > <[email protected]>wrote: > > Could you try putting spyOn() at starting of the spyOn() method. > > > On Sun, May 11, 2014 at 9:44 AM, Diego Freitas <[email protected]>wrote: > > 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. > > > > > -- > *Rishi Tandon* > Pearson Learning Technology Group > > Mobile: (310) 926-9032 > > Pearson > > -- *Diego Freitas* * (31)8884-8176* ConheƧa meu perfil no LinkedIn clicando aqui [image: Visualizar meu perfil no LinkedIn] <http://br.linkedin.com/pub/diego-freitas/27/821/21> -- 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.
