Last change
on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | import { TestBed } from '@angular/core/testing';<% if (routing) { %>
|
---|
2 | import { RouterTestingModule } from '@angular/router/testing';<% } %>
|
---|
3 | import { AppComponent } from './app.component';
|
---|
4 |
|
---|
5 | describe('AppComponent', () => {
|
---|
6 | beforeEach(async () => {
|
---|
7 | await TestBed.configureTestingModule({<% if (routing) { %>
|
---|
8 | imports: [
|
---|
9 | RouterTestingModule
|
---|
10 | ],<% } %>
|
---|
11 | declarations: [
|
---|
12 | AppComponent
|
---|
13 | ],
|
---|
14 | }).compileComponents();
|
---|
15 | });
|
---|
16 |
|
---|
17 | it('should create the app', () => {
|
---|
18 | const fixture = TestBed.createComponent(AppComponent);
|
---|
19 | const app = fixture.componentInstance;
|
---|
20 | expect(app).toBeTruthy();
|
---|
21 | });
|
---|
22 |
|
---|
23 | it(`should have as title '<%= name %>'`, () => {
|
---|
24 | const fixture = TestBed.createComponent(AppComponent);
|
---|
25 | const app = fixture.componentInstance;
|
---|
26 | expect(app.title).toEqual('<%= name %>');
|
---|
27 | });
|
---|
28 |
|
---|
29 | it('should render title', () => {
|
---|
30 | const fixture = TestBed.createComponent(AppComponent);
|
---|
31 | fixture.detectChanges();
|
---|
32 | const compiled = fixture.nativeElement as HTMLElement;
|
---|
33 | expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
|
---|
34 | });
|
---|
35 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.