key-output.component.spec.ts 2.39 KB
Newer Older
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
1
import { HttpClientTestingModule } from '@angular/common/http/testing';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
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 { JWT_OPTIONS, JwtModule } from '@auth0/angular-jwt';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
5 6
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
7 8 9 10 11
import { FilterKeysPipeMock } from '../../../_mocks/_pipes/FilterKeysPipeMock';
import { JustafewPipeMock } from '../../../_mocks/_pipes/JustafewPipeMock';
import { SearchFilterPipeMock } from '../../../_mocks/_pipes/SearchFilterPipeMock';
import { SortPipeMock } from '../../../_mocks/_pipes/SortPipeMock';
import { UnusedKeyFilterPipeMock } from '../../../_mocks/_pipes/UnusedKeyFilterPipeMock';
12
import { jwtOptionsFactory } from '../../lib/jwt.factory';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
13
import { CasLoginService } from '../../service/login/cas-login.service';
14 15
import { StorageService } from '../../service/storage/storage.service';
import { StorageServiceMock } from '../../service/storage/storage.service.mock';
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
16
import { UserService } from '../../service/user/user.service';
17 18 19 20 21 22 23 24
import { KeyOutputComponent } from './key-output.component';

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

  beforeEach(async(() => {
    TestBed.configureTestingModule({
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
25 26 27 28 29
      imports: [
        JwtModule.forRoot({
          jwtOptionsProvider: {
            provide: JWT_OPTIONS,
            useFactory: jwtOptionsFactory,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
30
            deps: [PLATFORM_ID, StorageService],
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
31
          },
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
32
        }), InfiniteScrollModule, FontAwesomeModule, HttpClientTestingModule,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
33
      ],
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
34
      declarations: [KeyOutputComponent, UnusedKeyFilterPipeMock, FilterKeysPipeMock, JustafewPipeMock, SearchFilterPipeMock, SortPipeMock],
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
35
      providers: [
36
        {
37 38
          provide: StorageService,
          useClass: StorageServiceMock,
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
39 40 41 42
        }, CasLoginService, {
          provide: UserService,
          useValue: {},
        },
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
43
      ],
44 45 46 47
    })
    .compileComponents();
  }));

Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
48
  beforeEach(async(() => {
49 50 51
    fixture = TestBed.createComponent(KeyOutputComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
52
  }));
53 54 55 56

  it('should create', () => {
    expect(component).toBeTruthy();
  });
Christopher Mark Fullarton's avatar
Christopher Mark Fullarton committed
57

58 59 60 61
  it('should contain a TYPE reference', () => {
    expect(KeyOutputComponent.TYPE).toEqual('KeyOutputComponent');
  });
});