confidence-rate.component.spec.ts 3.46 KB
Newer Older
1 2 3 4
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { DomSanitizer } from '@angular/platform-browser';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
5
import { TranslateService } from '@ngx-translate/core';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
6
import { MarkdownService, MarkedOptions } from 'ngx-markdown';
7
import { TranslateServiceMock } from '../../../../../_mocks/_services/TranslateServiceMock';
8 9 10 11 12 13 14
import { AttendeeMockService } from '../../../../service/attendee/attendee.mock.service';
import { AttendeeService } from '../../../../service/attendee/attendee.service';
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';
15 16
import { QuizMockService } from '../../../../service/quiz/quiz-mock.service';
import { QuizService } from '../../../../service/quiz/quiz.service';
17 18
import { SettingsService } from '../../../../service/settings/settings.service';
import { SharedService } from '../../../../service/shared/shared.service';
19 20
import { StorageService } from '../../../../service/storage/storage.service';
import { StorageServiceMock } from '../../../../service/storage/storage.service.mock';
21 22
import { TrackingMockService } from '../../../../service/tracking/tracking.mock.service';
import { TrackingService } from '../../../../service/tracking/tracking.service';
23
import { SharedModule } from '../../../../shared/shared.module';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
24

25
import { ConfidenceRateComponent } from './confidence-rate.component';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
26

27
describe('QuizResults: ConfidenceRateComponent', () => {
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
28 29 30 31 32
  let component: ConfidenceRateComponent;
  let fixture: ComponentFixture<ConfidenceRateComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
33
      imports: [
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
34
        SharedModule, RouterTestingModule,
35 36
      ],
      providers: [
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
37 38 39 40
        MarkdownService, {
          provide: MarkedOptions,
          useValue: {},
        },
41
        {
42 43 44
          provide: StorageService,
          useClass: StorageServiceMock,
        }, NgbActiveModal, {
45 46 47 48 49 50
          provide: TrackingService,
          useClass: TrackingMockService,
        }, FooterBarService, SettingsService, {
          provide: ConnectionService,
          useClass: ConnectionMockService,
        }, SharedService, {
51 52
          provide: QuizService,
          useClass: QuizMockService,
53 54 55
        }, I18nService, HeaderLabelService, {
          provide: AttendeeService,
          useClass: AttendeeMockService,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
56 57 58
        }, {
          provide: TranslateService,
          useClass: TranslateServiceMock,
59
        },
60
      ],
61
      declarations: [ConfidenceRateComponent],
62
    }).compileComponents();
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
63 64
  }));

65
  beforeEach(async(() => {
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
66 67 68
    fixture = TestBed.createComponent(ConfidenceRateComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
69
  }));
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
70

71
  it('should be created', async(() => {
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
72
    expect(component).toBeTruthy();
73
  }));
74 75 76 77 78 79 80 81

  it('should contain a TYPE reference', async(() => {
    expect(ConfidenceRateComponent.TYPE).toEqual('ConfidenceRateComponent');
  }));

  it('#sanitizeStyle', async(inject([DomSanitizer], (sanitizer: DomSanitizer) => {
    expect(component.sanitizeStyle('20%')).toBeTruthy();
  })));
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
82
});