Fix LoginService test

unit-test
Florian Hartwich 2017-04-15 03:31:04 +02:00
parent a964b4b492
commit 5eb77db89f
1 changed files with 6 additions and 2 deletions

View File

@ -38,12 +38,16 @@ describe('Login-Service', () => {
}) })
); );
it('should trigger a HTTP-GET and receive Users', (() => { it('should trigger a HTTP-GET and receive User-Object', (() => {
let user = {name: 'admin'};
mockBackend.connections.subscribe(connection => { mockBackend.connections.subscribe(connection => {
const expectedUrl = 'http://localhost:3000/api/users/'; const expectedUrl = 'http://localhost:3000/api/users?name=admin';
expect(connection.request.url).toBe(expectedUrl); expect(connection.request.url).toBe(expectedUrl);
expect(connection.request.method).toBe(RequestMethod.Get); expect(connection.request.method).toBe(RequestMethod.Get);
const response = new ResponseOptions({body: JSON.stringify(user)});
connection.mockRespond(new Response(response));
}); });
loginService.getUser('admin');
})); }));
}); });