From f753304e890b001487a1aace05ed166607705554 Mon Sep 17 00:00:00 2001 From: Dominic Watson Date: Fri, 11 Nov 2016 21:23:39 +0100 Subject: [PATCH] chore(test): wrap it statements in describe to group tests --- .../class/files/__path__/__name__.spec.ts | 6 ++-- .../files/__path__/__name__.component.spec.ts | 6 ++-- .../files/__path__/__name__.directive.spec.ts | 8 +++-- .../files/__path__/__name__.module.spec.ts | 8 +++-- .../files/__path__/app/app.component.spec.ts | 34 ++++++++++--------- .../pipe/files/__path__/__name__.pipe.spec.ts | 8 +++-- .../files/__path__/__name__.service.spec.ts | 9 +++-- 7 files changed, 47 insertions(+), 32 deletions(-) diff --git a/packages/angular-cli/blueprints/class/files/__path__/__name__.spec.ts b/packages/angular-cli/blueprints/class/files/__path__/__name__.spec.ts index 86dd09076edd..3e8db59fb1a4 100644 --- a/packages/angular-cli/blueprints/class/files/__path__/__name__.spec.ts +++ b/packages/angular-cli/blueprints/class/files/__path__/__name__.spec.ts @@ -1,7 +1,9 @@ import {<%= classifiedModuleName %>} from './<%= fileName %>'; describe('<%= classifiedModuleName %>', () => { - it('should create an instance', () => { - expect(new <%= classifiedModuleName %>()).toBeTruthy(); + describe('.constructor()', () => { + it('should create an instance', () => { + expect(new <%= classifiedModuleName %>()).toBeTruthy(); + }); }); }); diff --git a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts index dd1fec0b6e9e..22f66fe507c7 100644 --- a/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts +++ b/packages/angular-cli/blueprints/component/files/__path__/__name__.component.spec.ts @@ -22,7 +22,9 @@ describe('<%= classifiedModuleName %>Component', () => { fixture.detectChanges(); }); - it('should create', () => { - expect(component).toBeTruthy(); + describe('.constructor()', () => { + it('should create', () => { + expect(component).toBeTruthy(); + }); }); }); diff --git a/packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts b/packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts index b4c4aee63d0a..f13620a4fe00 100644 --- a/packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts +++ b/packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.spec.ts @@ -4,8 +4,10 @@ import { TestBed, async } from '@angular/core/testing'; import { <%= classifiedModuleName %>Directive } from './<%= dasherizedModuleName %>.directive'; describe('<%= classifiedModuleName %>Directive', () => { - it('should create an instance', () => { - let directive = new <%= classifiedModuleName %>Directive(); - expect(directive).toBeTruthy(); + describe('.constructor()', () => { + it('should create an instance', () => { + let directive = new <%= classifiedModuleName %>Directive(); + expect(directive).toBeTruthy(); + }); }); }); diff --git a/packages/angular-cli/blueprints/module/files/__path__/__name__.module.spec.ts b/packages/angular-cli/blueprints/module/files/__path__/__name__.module.spec.ts index 5a5bb7d753dd..164ae8d6879d 100644 --- a/packages/angular-cli/blueprints/module/files/__path__/__name__.module.spec.ts +++ b/packages/angular-cli/blueprints/module/files/__path__/__name__.module.spec.ts @@ -10,7 +10,9 @@ describe('<%= classifiedModuleName %>Module', () => { <%= camelizedModuleName %>Module = new <%= classifiedModuleName %>Module(); }); - it('should create an instance', () => { - expect(<%= camelizedModuleName %>Module).toBeTruthy(); - }) + describe('.constructor()', () => { + it('should create an instance', () => { + expect(<%= camelizedModuleName %>Module).toBeTruthy(); + }); + }); }); diff --git a/packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts b/packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts index c1a8e79e1e27..b5fe04ac80b3 100644 --- a/packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts +++ b/packages/angular-cli/blueprints/ng2/files/__path__/app/app.component.spec.ts @@ -12,22 +12,24 @@ describe('AppComponent', () => { }); }); - it('should create the app', async(() => { - let fixture = TestBed.createComponent(AppComponent); - let app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); + describe('.constructor()', () => { + it('should create the app', async(() => { + let fixture = TestBed.createComponent(AppComponent); + let app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); - it(`should have as title '<%= prefix %> works!'`, async(() => { - let fixture = TestBed.createComponent(AppComponent); - let app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('<%= prefix %> works!'); - })); + it(`should have as title '<%= prefix %> works!'`, async(() => { + let fixture = TestBed.createComponent(AppComponent); + let app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('<%= prefix %> works!'); + })); - it('should render title in a h1 tag', async(() => { - let fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - let compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('<%= prefix %> works!'); - })); + it('should render title in a h1 tag', async(() => { + let fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + let compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain('<%= prefix %> works!'); + })); + }); }); diff --git a/packages/angular-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts b/packages/angular-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts index 7d0cee51aae8..34c898e92b1f 100644 --- a/packages/angular-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts +++ b/packages/angular-cli/blueprints/pipe/files/__path__/__name__.pipe.spec.ts @@ -4,8 +4,10 @@ import { TestBed, async } from '@angular/core/testing'; import { <%= classifiedModuleName %>Pipe } from './<%= dasherizedModuleName %>.pipe'; describe('<%= classifiedModuleName %>Pipe', () => { - it('create an instance', () => { - let pipe = new <%= classifiedModuleName %>Pipe(); - expect(pipe).toBeTruthy(); + describe('.constructor()', () => { + it('create an instance', () => { + let pipe = new <%= classifiedModuleName %>Pipe(); + expect(pipe).toBeTruthy(); + }); }); }); diff --git a/packages/angular-cli/blueprints/service/files/__path__/__name__.service.spec.ts b/packages/angular-cli/blueprints/service/files/__path__/__name__.service.spec.ts index f1a12e7ab3d6..50d801bbba88 100644 --- a/packages/angular-cli/blueprints/service/files/__path__/__name__.service.spec.ts +++ b/packages/angular-cli/blueprints/service/files/__path__/__name__.service.spec.ts @@ -10,7 +10,10 @@ describe('<%= classifiedModuleName %>Service', () => { }); }); - it('should ...', inject([<%= classifiedModuleName %>Service], (service: <%= classifiedModuleName %>Service) => { - expect(service).toBeTruthy(); - })); + describe('.constructor()', () => { + it('should ...', + inject([<%= classifiedModuleName %>Service], (service: <%= classifiedModuleName %>Service) => { + expect(service).toBeTruthy(); + })); + }); });