Skip to content

Instantly share code, notes, and snippets.

@lfreneda
Created December 19, 2019 13:45
Show Gist options
  • Save lfreneda/d029bfd90ba4a16f22758c8befbc44f7 to your computer and use it in GitHub Desktop.
Save lfreneda/d029bfd90ba4a16f22758c8befbc44f7 to your computer and use it in GitHub Desktop.
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