-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathapp.spec.ts.template
31 lines (27 loc) · 1.01 KB
/
app.spec.ts.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<% if(zoneless) { %>import { provideZonelessChangeDetection } from '@angular/core';
<% } %>import { TestBed } from '@angular/core/testing';
import { App } from './app';
describe('App', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [App],<% if(zoneless) { %>
providers: [provideZonelessChangeDetection()]<% } %>
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have the '<%= name %>' title`, () => {
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app.title).toEqual('<%= name %>');
});
it('should render title', () => {
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, <%= name %>');
});
});