mardi 30 juin 2015

Handling a post in angular unit tests

In my Angular app I have a view that, as soon as it is loaded a POST is made. At first I was getting this Error:

"Unexpected request: POST /api/stuff

Now however I have inserted this code:

$httpBackend.expectPOST("/api/stuff",[{}]).respond(200,{});

This removes the initial error but instead I am left with this Error:

"message": "Expected POST /api/stuff with different data
EXPECTED: [{}]
GOT:      {}"

If anyone has any ideas on how to resolve this, that would be greatly appreciated. If more code is needed please ask. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire