admin-overview.component.spec.ts 3.11 KB
Newer Older
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
1
import { HttpClientTestingModule } from '@angular/common/http/testing';
2
import { PLATFORM_ID } from '@angular/core';
3
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
4
import { RouterTestingModule } from '@angular/router/testing';
5
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
6
import { TranslateService } from '@ngx-translate/core';
7
import { RxStompService } from '@stomp/ng2-stompjs';
8
import { TranslateServiceMock } from '../../../_mocks/_services/TranslateServiceMock';
9
import { jwtOptionsFactory } from '../../lib/jwt.factory';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
10 11 12 13 14
import { ConnectionMockService } from '../../service/connection/connection.mock.service';
import { ConnectionService } from '../../service/connection/connection.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { HeaderLabelService } from '../../service/header-label/header-label.service';
import { I18nService } from '../../service/i18n/i18n.service';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
15
import { QuizMockService } from '../../service/quiz/quiz-mock.service';
16
import { QuizService } from '../../service/quiz/quiz.service';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
17 18 19 20 21 22 23 24
import { SettingsService } from '../../service/settings/settings.service';
import { SharedService } from '../../service/shared/shared.service';
import { StorageService } from '../../service/storage/storage.service';
import { StorageServiceMock } from '../../service/storage/storage.service.mock';
import { ThemesService } from '../../service/themes/themes.service';
import { TrackingMockService } from '../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../service/tracking/tracking.service';
import { SharedModule } from '../../shared/shared.module';
25 26 27 28 29 30 31 32 33

import { AdminOverviewComponent } from './admin-overview.component';

describe('AdminOverviewComponent', () => {
  let component: AdminOverviewComponent;
  let fixture: ComponentFixture<AdminOverviewComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
34
      imports: [
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
35
        SharedModule, RouterTestingModule, HttpClientTestingModule, JwtModule.forRoot({
36 37 38 39 40 41
          jwtOptionsProvider: {
            provide: JWT_OPTIONS,
            useFactory: jwtOptionsFactory,
            deps: [PLATFORM_ID],
          },
        }),
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
42 43
      ],
      providers: [
44
        RxStompService,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
45 46 47
        {
          provide: TranslateService,
          useClass: TranslateServiceMock,
48
        }, I18nService, {
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
49 50 51
          provide: StorageService,
          useClass: StorageServiceMock,
        }, HeaderLabelService, ThemesService, {
52
          provide: QuizService,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
53
          useClass: QuizMockService,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
54 55 56 57 58 59 60 61 62 63 64 65
        }, {
          provide: TrackingService,
          useClass: TrackingMockService,
        }, FooterBarService, SettingsService, {
          provide: ConnectionService,
          useClass: ConnectionMockService,
        }, SharedService,
      ],
      declarations: [
        AdminOverviewComponent,
      ],
    }).compileComponents();
66 67 68 69 70 71 72 73 74 75 76 77
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AdminOverviewComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});