Fix LoginService test
parent
a964b4b492
commit
5eb77db89f
|
@ -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');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue