This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
FoodLoop-Web/src/app/app.component.spec.ts

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2017-08-24 15:25:23 +00:00
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
// Items under test
import { AppComponent } from './app.component';
describe('AppComponent', () => {
2017-08-24 15:25:23 +00:00
let fixture: ComponentFixture<AppComponent>;
let app: AppComponent;
let de: DebugElement;
let appDocument: any;
2017-08-24 15:25:23 +00:00
beforeEach(async(() => {
TestBed
.configureTestingModule({
declarations: [
AppComponent
],
imports: [
RouterTestingModule.withRoutes(
[{path: '', component: AppComponent}]
)
]
})
.compileComponents();
}));
2017-08-24 15:25:23 +00:00
beforeEach(() => {
2017-08-24 15:25:23 +00:00
fixture = TestBed.createComponent(AppComponent);
app = fixture.componentInstance;
de = fixture.debugElement;
appDocument = de.nativeElement;
});
2017-08-24 15:25:23 +00:00
it('should create the app', async(() => {
expect(app).toBeTruthy();
}));
2017-08-24 15:25:23 +00:00
it('should have a router-outlet', async(() => {
expect(appDocument.querySelector('router-outlet')).toBeTruthy();
}));
});