Skip to content
Snippets Groups Projects
Forked from an inaccessible project.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
app.component.spec.ts 1.65 KiB
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TestBed, async } from '@angular/core/testing';
import { Component, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';

import { CoreModule } from '@app/core/core.module';
import { SharedModule } from '@app/shared/shared.module';
import { AppComponent } from './app.component';
import { SidenavService } from './core/service/sidenav.service';

const routes: Routes = [
	{
		path: '',
		loadChildren: './degree-planner/degree-planner.module#DegreePlannerModule'
	}
];

@Component({
	template: '<div>lazy-loaded</div>'
	})
	class LazyComponent { }

	@NgModule({
	imports: [RouterModule],
	declarations: [LazyComponent]
	})
	class LazyModule { }

describe('AppComponent', () => {
	beforeEach(async(() => {
		TestBed.configureTestingModule({
			imports: [ CoreModule, SharedModule, RouterModule,BrowserAnimationsModule, RouterTestingModule.withRoutes(routes)],
			schemas: [ NO_ERRORS_SCHEMA ],
			providers: [ SidenavService ],
			declarations: [
				AppComponent
			],
		}).compileComponents();
	}));
	it('should create the app', async(() => {
		const fixture = TestBed.createComponent(AppComponent);
		const app = fixture.debugElement.componentInstance;
		expect(app).toBeTruthy();
	}));

	it('should render title in a router-outlet tag', async(() => {
		const fixture = TestBed.createComponent(AppComponent);
		fixture.detectChanges();
		const compiled = fixture.debugElement.nativeElement;
		expect(compiled.querySelector('router-outlet').textContent).toBeDefined();
		}));
});