75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import { RouterTestingModule } from '@angular/router/testing';
|
|
import { LayoutModule } from '@angular/cdk/layout';
|
|
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatListModule } from '@angular/material/list';
|
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
import { AppComponent } from './app.component';
|
|
|
|
describe('AppComponent', () => {
|
|
|
|
let component: AppComponent;
|
|
let fixture: ComponentFixture<AppComponent>;
|
|
|
|
beforeEach(waitForAsync(() => {
|
|
TestBed.configureTestingModule({
|
|
declarations: [AppComponent],
|
|
imports: [
|
|
NoopAnimationsModule,
|
|
LayoutModule,
|
|
MatButtonModule,
|
|
MatIconModule,
|
|
MatListModule,
|
|
MatSidenavModule,
|
|
MatToolbarModule,
|
|
]
|
|
}).compileComponents();
|
|
}));
|
|
|
|
beforeEach(() => {
|
|
fixture = TestBed.createComponent(AppComponent);
|
|
component = fixture.componentInstance;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
it('should compile', () => {
|
|
expect(component).toBeTruthy();
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
imports: [
|
|
RouterTestingModule
|
|
],
|
|
declarations: [
|
|
AppComponent
|
|
],
|
|
}).compileComponents();
|
|
});
|
|
|
|
it('should create the app', () => {
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
const app = fixture.componentInstance;
|
|
expect(app).toBeTruthy();
|
|
});
|
|
|
|
it(`should have as title 'dnet-is-application'`, () => {
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
const app = fixture.componentInstance;
|
|
expect(app.title).toEqual('dnet-is-application');
|
|
});
|
|
|
|
it('should render title', () => {
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
fixture.detectChanges();
|
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
expect(compiled.querySelector('.content span')?.textContent).toContain('dnet-is-application app is running!');
|
|
});
|
|
});
|
|
|
|
|
|
|