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

44 lines
1.1 KiB
TypeScript

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', () => {
let fixture: ComponentFixture<AppComponent>;
let app: AppComponent;
let de: DebugElement;
let appDocument: any;
beforeEach(async(() => {
TestBed
.configureTestingModule({
declarations: [
AppComponent
],
imports: [
RouterTestingModule.withRoutes(
[{path: '', component: AppComponent}]
)
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AppComponent);
app = fixture.componentInstance;
de = fixture.debugElement;
appDocument = de.nativeElement;
});
it('should create the app', async(() => {
expect(app).toBeTruthy();
}));
it('should have a router-outlet', async(() => {
expect(appDocument.querySelector('router-outlet')).toBeTruthy();
}));
});