Skip to content

Commit 7231379

Browse files
Add RouterTestingModule and Zoneless Change Detection to AppComponent tests for improved routing and performance
1 parent 0e46a28 commit 7231379

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

projects/admin/src/app/app.component.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideZonelessChangeDetection } from '@angular/core';
3+
import { RouterTestingModule } from '@angular/router/testing';
24

35
import { AppComponent } from './app.component';
46

@@ -8,7 +10,8 @@ describe('AppComponent', () => {
810

911
beforeEach(async () => {
1012
await TestBed.configureTestingModule({
11-
imports: [AppComponent]
13+
imports: [AppComponent, RouterTestingModule],
14+
providers: [provideZonelessChangeDetection()]
1215
})
1316
.compileComponents();
1417

projects/admin/src/app/app.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('App', () => {
66
beforeEach(async () => {
77
await TestBed.configureTestingModule({
88
imports: [App],
9-
providers: [provideZonelessChangeDetection()]
9+
providers: [provideZonelessChangeDetection()],
1010
}).compileComponents();
1111
});
1212

@@ -15,11 +15,4 @@ describe('App', () => {
1515
const app = fixture.componentInstance;
1616
expect(app).toBeTruthy();
1717
});
18-
19-
it('should render title', () => {
20-
const fixture = TestBed.createComponent(App);
21-
fixture.detectChanges();
22-
const compiled = fixture.nativeElement as HTMLElement;
23-
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, admin');
24-
});
2518
});

0 commit comments

Comments
 (0)