| 123456789101112131415161718192021222324252627282930 |
- import { TestBed } from '@angular/core/testing';
- import { provideRouter } from '@angular/router';
- import { AppComponent } from './app.component';
- import { APP_NAME } from './core/app.constants';
- describe('AppComponent', () => {
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- imports: [AppComponent],
- providers: [provideRouter([])],
- }).compileComponents();
- });
- it('should create the app', () => {
- const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app).toBeTruthy();
- });
- it('should render the router outlet', () => {
- const fixture = TestBed.createComponent(AppComponent);
- fixture.detectChanges();
- const compiled = fixture.nativeElement as HTMLElement;
- expect(compiled.querySelector('router-outlet')).not.toBeNull();
- });
- it('uses the final product name', () => {
- expect(APP_NAME).toBe('小树陪练');
- });
- });
|