message: Add tests for setup based on retrieved configuration
diff: @@ -7,7 +7,7 @@ import { TranslateModule } from '@ngx-translate/core'
  import { HttpClientTestingModule } from '@angular/common/http/testing'
  import { MatCardModule } from '@angular/material/card'
  import { MatFormFieldModule } from '@angular/material/form-field'
  -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
  +import { ComponentFixture, fakeAsync, TestBed, waitForAsync } from '@angular/core/testing'
  import { MatInputModule } from '@angular/material/input'
  import { ReactiveFormsModule } from '@angular/forms'
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
  @@ -27,14 +27,19 @@ import { MatDialogModule } from '@angular/material/dialog'
  import { MatIconModule } from '@angular/material/icon'
  import { MatCheckboxModule } from '@angular/material/checkbox'
  import { MatTooltipModule } from '@angular/material/tooltip'
  +import { ConfigurationService } from '../Services/configuration.service'
  +import { throwError } from 'rxjs/internal/observable/throwError'
  describe('DeluxeUserComponent', () => {
  let component: DeluxeUserComponent
  let fixture: ComponentFixture<DeluxeUserComponent>
  let userService
  let cookieService: any
  + let configurationService: any
  beforeEach(waitForAsync(() => {
  + configurationService = jasmine.createSpyObj('ConfigurationService', ['getApplicationConfiguration'])
  + configurationService.getApplicationConfiguration.and.returnValue(of({ application: { } }))
  userService = jasmine.createSpyObj('UserService', ['deluxeStatus', 'upgradeToDeluxe', 'saveLastLoginIp'])
  userService.deluxeStatus.and.returnValue(of({}))
  userService.upgradeToDeluxe.and.returnValue(of({}))
  @@ -68,6 +73,7 @@ describe('DeluxeUserComponent', () => {
  declarations: [DeluxeUserComponent, LoginComponent],
  providers: [
  { provide: UserService, useValue: userService },
  + { provide: ConfigurationService, useValue: configurationService },
  { provide: CookieService, useValue: cookieService }
  ]
  })
  @@ -91,5 +97,25 @@ describe('DeluxeUserComponent', () => {
  expect(component.membershipCost).toEqual(30)
  })
  - // TODO Add test that checks if websocket gets notified as expected
  + it('should set application name and logo as obtained from configuration', () => {
  + configurationService.getApplicationConfiguration.and.returnValue(of({ application: { name: 'Name', logo: 'Logo' } }))
  + component.ngOnInit()
  +
  + expect(component.applicationName).toBe('Name')
  + expect(component.logoSrc).toBe('assets/public/images/Logo')
  + })
  +
  + it('should assemble internal logo location from image base path and URL obtained from configuration', () => {
  + configurationService.getApplicationConfiguration.and.returnValue(of({ application: { logo: 'http://test.com/logo.jpg' } }))
  + component.ngOnInit()
  +
  + expect(component.logoSrc).toBe('assets/public/images/logo.jpg')
  + })
  +
  + it('should log error on failure in retrieving configuration from backend', fakeAsync(() => {
  + configurationService.getApplicationConfiguration.and.returnValue(throwError('Error'))
  + console.log = jasmine.createSpy('log')
  + component.ngOnInit()
  + expect(console.log).toHaveBeenCalledWith('Error')
  + }))
  })
  