From 5eb77db89f8b6e564d55195063a36b4d9bcd64ce Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sat, 15 Apr 2017 03:31:04 +0200 Subject: [PATCH] Fix LoginService test --- .../src/app/services/login-service/login.service.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/project-manager/src/app/services/login-service/login.service.spec.ts b/project-manager/src/app/services/login-service/login.service.spec.ts index a52af17..9c6d013 100644 --- a/project-manager/src/app/services/login-service/login.service.spec.ts +++ b/project-manager/src/app/services/login-service/login.service.spec.ts @@ -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 => { - 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.method).toBe(RequestMethod.Get); + const response = new ResponseOptions({body: JSON.stringify(user)}); + connection.mockRespond(new Response(response)); }); + loginService.getUser('admin'); })); });