Skip to content

Commit c604fe2

Browse files
author
laco0416
committed
fix(generate): make generated component.spec consistent with AppComponent spec
1 parent 911caa2 commit c604fe2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@ import { TestBed, async } from '@angular/core/testing';
44
import { <%= classifiedModuleName %>Component } from './<%= dasherizedModuleName %>.component';
55

66
describe('Component: <%= classifiedModuleName %>', () => {
7-
it('should create an instance', () => {
8-
let component = new <%= classifiedModuleName %>Component();
9-
expect(component).toBeTruthy();
7+
8+
beforeEach(() => {
9+
TestBed.configureTestingModule({
10+
declarations: [
11+
<%= classifiedModuleName %>Component
12+
],
13+
});
1014
});
15+
16+
it('should create an instance', async(() => {
17+
let fixture = TestBed.createComponent(<%= classifiedModuleName %>Component);
18+
let cmp = fixture.debugElement.componentInstance;
19+
expect(cmp).toBeTruthy();
20+
}));
1121
});

0 commit comments

Comments
 (0)