angularjs - Unit testing a $http.post, jquery issue? -


trying make unit test form post.

here http.post

  $http({     method: 'post',     url: '/api/project',     data: $.param($scope.project),     headers: { 'content-type': 'application/x-www-form-urlencoded' }  // set headers angular passing info form data (not request payload)   }) 

when run unit test, get:

syntaxerror: unexpected token p 

it's p in $.*p*aram.

i have included jquery @ top in karma file. , recognizes $.

this (incomplete) test:

  it('should return status 200 when posting data', function(){     scope.submit();     mockbackend.expectpost('/api/project', {title: 'test'}).respond({id: 2});     mockbackend.flush();   }); 

any ideas do?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -