Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mocking_http_angularjs
describe('HTTP GET', function () {
it("get github username", function () {
var response;
$httpBackend.when('GET', 'https://api.github.com/users/marciofmjr')
.respond(200, {worked: true});
ContaAzulHelper.github().then(function(data) {
response = data;
});
$httpBackend.flush();
expect(response.data.worked).toEqual(true);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment