2017-03-02 13:28:28 +00:00
|
|
|
import { async, inject, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
|
|
import { APP_BASE_HREF } from '@angular/common';
|
2017-02-02 23:02:23 -08:00
|
|
|
import { AppComponent } from './app.component';
|
|
|
|
import { AppModule } from './app.module';
|
2017-03-02 13:28:28 +00:00
|
|
|
import { SearchService } from 'app/search/search.service';
|
2017-03-13 19:58:31 +00:00
|
|
|
import { MockSearchService } from 'testing/search.service';
|
2017-02-02 23:02:23 -08:00
|
|
|
|
2017-01-27 00:20:51 -08:00
|
|
|
describe('AppComponent', () => {
|
2017-02-02 23:02:23 -08:00
|
|
|
let component: AppComponent;
|
|
|
|
let fixture: ComponentFixture<AppComponent>;
|
2017-01-27 00:20:51 -08:00
|
|
|
|
2017-02-02 23:02:23 -08:00
|
|
|
beforeEach(async(() => {
|
|
|
|
TestBed.configureTestingModule({
|
|
|
|
imports: [ AppModule ],
|
|
|
|
providers: [
|
2017-03-13 19:58:31 +00:00
|
|
|
{ provide: APP_BASE_HREF, useValue: '/' },
|
|
|
|
{ provide: SearchService, useClass: MockSearchService }
|
2017-02-02 23:02:23 -08:00
|
|
|
]
|
|
|
|
});
|
|
|
|
TestBed.compileComponents();
|
|
|
|
}));
|
2017-01-27 00:20:51 -08:00
|
|
|
|
2017-02-02 23:02:23 -08:00
|
|
|
beforeEach(() => {
|
|
|
|
fixture = TestBed.createComponent(AppComponent);
|
|
|
|
component = fixture.componentInstance;
|
|
|
|
});
|
2017-01-27 00:20:51 -08:00
|
|
|
|
2017-02-02 23:02:23 -08:00
|
|
|
it('should create', () => {
|
|
|
|
expect(component).toBeDefined();
|
|
|
|
});
|
2017-03-02 13:28:28 +00:00
|
|
|
|
|
|
|
describe('isHamburgerVisible', () => {
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('onResize', () => {
|
|
|
|
it('should update `isSideBySide` accordingly', () => {
|
|
|
|
component.onResize(1000);
|
|
|
|
expect(component.isSideBySide).toBe(true);
|
|
|
|
component.onResize(500);
|
|
|
|
expect(component.isSideBySide).toBe(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('currentDocument', () => {
|
2017-03-13 19:58:31 +00:00
|
|
|
console.log('PENDING: AppComponent currentDocument');
|
2017-03-02 13:28:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('navigationViews', () => {
|
2017-03-13 19:58:31 +00:00
|
|
|
console.log('PENDING: AppComponent navigationViews');
|
2017-03-02 13:28:28 +00:00
|
|
|
});
|
|
|
|
|
2017-03-13 19:58:31 +00:00
|
|
|
describe('initialisation', () => {
|
|
|
|
it('should initialize the search worker', inject([SearchService], (searchService: SearchService) => {
|
|
|
|
fixture.detectChanges(); // triggers ngOnInit
|
|
|
|
expect(searchService.initWorker).toHaveBeenCalled();
|
|
|
|
expect(searchService.loadIndex).toHaveBeenCalled();
|
|
|
|
}));
|
2017-03-02 13:28:28 +00:00
|
|
|
});
|
2017-02-02 23:02:23 -08:00
|
|
|
});
|