-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tests): update specs with TestBed
- Loading branch information
1 parent
339af33
commit 48a695e
Showing
6 changed files
with
34 additions
and
22 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
addon/ng2/blueprints/component/files/__path__/__name__.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
addon/ng2/blueprints/directive/files/__path__/__name__.directive.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
addon/ng2/blueprints/module/files/__path__/__name__.module.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 23 additions & 10 deletions
33
addon/ng2/blueprints/ng2/files/__path__/app/app.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
|
||
import { addProviders, async, inject } from '@angular/core/testing'; | ||
import { TestBed, async } from '@angular/core/testing'; | ||
import { AppComponent } from './app.component'; | ||
|
||
describe('App: <%= jsComponentName %>', () => { | ||
beforeEach(() => { | ||
addProviders([AppComponent]); | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AppComponent | ||
], | ||
}); | ||
}); | ||
|
||
it('should create the app', | ||
inject([AppComponent], (app: AppComponent) => { | ||
expect(app).toBeTruthy(); | ||
})); | ||
it('should create the app', async(() => { | ||
let fixture = TestBed.createComponent(AppComponent); | ||
let app = fixture.debugElement.componentInstance; | ||
expect(app).toBeTruthy(); | ||
})); | ||
|
||
it('should have as title \'app works!\'', | ||
inject([AppComponent], (app: AppComponent) => { | ||
expect(app.title).toEqual('app works!'); | ||
})); | ||
it(`should have as title 'app works!'`, async(() => { | ||
let fixture = TestBed.createComponent(AppComponent); | ||
let app = fixture.debugElement.componentInstance; | ||
expect(app.title).toEqual('app 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('app works!'); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
addon/ng2/blueprints/service/files/__path__/__name__.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
|
||
import { addProviders, async, inject } from '@angular/core/testing'; | ||
import { TestBed, async, inject } from '@angular/core/testing'; | ||
import { <%= classifiedModuleName %>Service } from './<%= dasherizedModuleName %>.service'; | ||
|
||
describe('Service: <%= classifiedModuleName %>', () => { | ||
beforeEach(() => { | ||
addProviders([<%= classifiedModuleName %>Service]); | ||
TestBed.configureTestingModule({ | ||
providers: [<%= classifiedModuleName %>Service] | ||
}); | ||
}); | ||
|
||
it('should ...', | ||
inject([<%= classifiedModuleName %>Service], | ||
(service: <%= classifiedModuleName %>Service) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
it('should ...', inject([<%= classifiedModuleName %>Service], (service: <%= classifiedModuleName %>Service) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
}); |