Skip to content

Commit

Permalink
chore: update deprecated test functions (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiverson authored and PatrickJS committed Aug 9, 2016
1 parent f71d4e6 commit e53e69f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
10 changes: 4 additions & 6 deletions src/app/about/about.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import { TestComponentBuilder } from '@angular/compiler/testing';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {
beforeEachProviders,
describe,
inject,
it
addProviders,
inject
} from '@angular/core/testing';

// Load the implementations that should be tested
import { About } from './about.component';

describe('About', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
beforeEach(() => addProviders([
// provide a better mock
{
provide: ActivatedRoute,
Expand All @@ -24,7 +22,7 @@ describe('About', () => {
}
},
About
]);
]));

it('should log ngOnInit', inject([ About ], (about) => {
spyOn(console, 'log');
Expand Down
9 changes: 4 additions & 5 deletions src/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
beforeEachProviders,
inject,
it
addProviders,
inject
} from '@angular/core/testing';

// Load the implementations that should be tested
Expand All @@ -10,10 +9,10 @@ import { AppState } from './app.service';

describe('App', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
beforeEach(() => addProviders([
AppState,
App
]);
]));

it('should have a url', inject([ App ], (app) => {
expect(app.url).toEqual('https://twitter.com/AngularClass');
Expand Down
10 changes: 4 additions & 6 deletions src/app/home/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
beforeEachProviders,
describe,
inject,
it
addProviders,
inject
} from '@angular/core/testing';
import { Component } from '@angular/core';
import { BaseRequestOptions, Http } from '@angular/http';
Expand All @@ -15,7 +13,7 @@ import { Title } from './title';

describe('Home', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
beforeEach(() => addProviders([
BaseRequestOptions,
MockBackend,
{
Expand All @@ -29,7 +27,7 @@ describe('Home', () => {
AppState,
Title,
Home
]);
]));

it('should have default data', inject([ Home ], (home) => {
expect(home.localState).toEqual({ value: '' });
Expand Down
9 changes: 4 additions & 5 deletions src/app/home/title/title.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
beforeEachProviders,
inject,
it
addProviders,
inject
} from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { Component } from '@angular/core';
Expand All @@ -11,7 +10,7 @@ import { MockBackend } from '@angular/http/testing';
import { Title } from './title.service';

describe('Title', () => {
beforeEachProviders(() => [
beforeEach(() => addProviders([
BaseRequestOptions,
MockBackend,
{
Expand All @@ -23,7 +22,7 @@ describe('Title', () => {
},

Title
]);
]));


it('should have http', inject([ Title ], (title) => {
Expand Down
6 changes: 2 additions & 4 deletions src/app/home/x-large/x-large.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
async,
beforeEachProviders,
describe,
inject,
it
addProviders,
inject
} from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { Component } from '@angular/core';
Expand Down

0 comments on commit e53e69f

Please sign in to comment.