File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 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+ })
You can’t perform that action at this time.
0 commit comments