quiz-public.component.spec.ts 2.43 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 { ActivatedRoute } from '@angular/router';
5
import { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
6 7
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { TranslateService } from '@ngx-translate/core';
8
import { RxStompService } from '@stomp/ng2-stompjs';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
9
import { of } from 'rxjs';
10 11
import { TranslatePipeMock } from '../../../_mocks/_pipes/TranslatePipeMock';
import { TranslateServiceMock } from '../../../_mocks/_services/TranslateServiceMock';
12
import { jwtOptionsFactory } from '../../lib/jwt.factory';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
13 14 15 16 17
import { FileUploadMockService } from '../../service/file-upload/file-upload.mock.service';
import { FileUploadService } from '../../service/file-upload/file-upload.service';
import { FooterBarService } from '../../service/footer-bar/footer-bar.service';
import { QuizMockService } from '../../service/quiz/quiz-mock.service';
import { QuizService } from '../../service/quiz/quiz.service';
18 19 20 21 22 23 24 25
import { QuizPublicComponent } from './quiz-public.component';

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

  beforeEach(async(() => {
    TestBed.configureTestingModule({
26 27 28 29 30 31 32 33 34
      imports: [
        FontAwesomeModule, HttpClientTestingModule, JwtModule.forRoot({
          jwtOptionsProvider: {
            provide: JWT_OPTIONS,
            useFactory: jwtOptionsFactory,
            deps: [PLATFORM_ID],
          },
        }),
      ],
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
35
      providers: [
36
        RxStompService,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
37 38 39
        {
          provide: TranslateService,
          useClass: TranslateServiceMock,
40
        }, FooterBarService, {
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
          provide: FileUploadService,
          useClass: FileUploadMockService,
        }, {
          provide: QuizService,
          useClass: QuizMockService,
        }, {
          provide: ActivatedRoute,
          useValue: {
            paramMap: of({
              get: () => 0,
            }),
          },
        },
      ],
      declarations: [QuizPublicComponent, TranslatePipeMock],
56 57 58 59 60 61 62 63 64 65 66 67 68 69
    })
    .compileComponents();
  }));

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

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