Skip to content

Instantly share code, notes, and snippets.

@cironunes
Created August 19, 2017 15:22
Show Gist options
  • Save cironunes/3564f4572880438ad1f99702397cee1b to your computer and use it in GitHub Desktop.
Save cironunes/3564f4572880438ad1f99702397cee1b to your computer and use it in GitHub Desktop.
describe('#getUsers', () => {
it('should return an Observable<User[]>', () => {
const dummyUsers = [
{ login: 'John' },
{ login: 'Doe' }
];
service.getUsers().subscribe(users => {
expect(users.length).toBe(2);
expect(users).toEqual(dummyUsers);
});
const req = httpMock.expectOne(`${service.API_URL}/users`);
expect(req.request.method).toBe("GET");
req.flush(dummyUsers);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment