Skip to content

Commit 252cffd

Browse files
fix: stub app.component test template
1 parent c9bb5c2 commit 252cffd

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing'
2+
import { APP_BASE_HREF } from '@angular/common'
3+
import { Component } from '@angular/core'
4+
import { AppBrowserModule } from '../browser/app.browser.module'
5+
import { RouterModule } from '../../node_modules/@angular/router'
6+
import { AppComponent } from './app.component'
7+
8+
@Component({
9+
selector: 'test-cmp',
10+
template: '<app-root></app-root>'
11+
})
12+
class TestComponent { }
13+
14+
describe('App component', () => {
15+
let fixture: ComponentFixture<TestComponent>
16+
17+
beforeEach(async(() => {
18+
TestBed.configureTestingModule({
19+
imports: [
20+
AppBrowserModule,
21+
RouterModule.forRoot([
22+
{ path: '', component: AppComponent }
23+
])
24+
],
25+
declarations: [TestComponent],
26+
providers: [
27+
{ provide: APP_BASE_HREF, useValue: '/' }
28+
]
29+
}).compileComponents()
30+
}))
31+
32+
beforeEach(async(() => {
33+
fixture = TestBed.createComponent(TestComponent)
34+
}))
35+
36+
afterEach(async(() => {
37+
TestBed.resetTestingModule()
38+
}))
39+
40+
it('should build without a problem', async(() => {
41+
expect(fixture.nativeElement).toBeTruthy()
42+
expect(fixture.nativeElement).toMatchSnapshot()
43+
}))
44+
})

0 commit comments

Comments
 (0)