Skip to content

Commit 2410b2d

Browse files
davideastjeffbcross
authored andcommitted
feat: upgrade to RC7 (#505)
1 parent 1eb449a commit 2410b2d

15 files changed

+156
-148
lines changed

karma-test-shim.js

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,31 @@ System.config({
3030

3131
System.config(
3232
{
33+
paths: {
34+
// paths serve as alias
35+
'npm:': 'node_modules/'
36+
},
3337
map: {
34-
'rxjs': 'node_modules/rxjs',
35-
'@angular': 'node_modules/@angular',
36-
firebase: 'node_modules/firebase/firebase.js',
37-
'app': 'dist'
38+
'app': 'dist',
39+
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
40+
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
41+
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
42+
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
43+
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
44+
45+
// angular testing umd bundles
46+
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
47+
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
48+
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
49+
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
50+
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
51+
52+
// other libraries
53+
'rxjs': 'npm:rxjs',
54+
'firebase': 'npm:firebase/firebase.js'
3855
},
3956
packages: {
4057
'app': {
41-
main: 'main.js',
42-
defaultExtension: 'js'
43-
},
44-
'@angular/core': {
45-
main: 'index.js',
46-
defaultExtension: 'js'
47-
},
48-
'@angular/compiler': {
49-
main: 'index.js',
50-
defaultExtension: 'js'
51-
},
52-
'@angular/common': {
53-
main: 'index.js',
54-
defaultExtension: 'js'
55-
},
56-
'@angular/platform-browser': {
57-
main: 'index.js',
58-
defaultExtension: 'js'
59-
},
60-
'@angular/platform-browser-dynamic': {
61-
main: 'index.js',
6258
defaultExtension: 'js'
6359
},
6460
'rxjs': {
@@ -75,8 +71,10 @@ Promise.all([
7571
var testing = providers[0];
7672
var testingBrowser = providers[1];
7773

78-
testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
79-
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
74+
testing.TestBed.initTestEnvironment(
75+
testingBrowser.BrowserDynamicTestingModule,
76+
testingBrowser.platformBrowserDynamicTesting()
77+
);
8078

8179
}).then(function() {
8280
// Finally, load all spec files.

karma.conf.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,27 @@ module.exports = function(config) {
1818

1919
// Zone.js dependencies
2020
'node_modules/zone.js/dist/zone.js',
21+
'node_modules/zone.js/dist/proxy.js',
22+
'node_modules/zone.js/dist/sync-test.js',
2123
'node_modules/zone.js/dist/jasmine-patch.js',
2224
'node_modules/zone.js/dist/async-test.js',
25+
'node_modules/zone.js/dist/fake-async-test.js',
2326

2427
// RxJs.
2528
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
2629
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
2730

2831

29-
{pattern: 'karma-test-shim.js', included: true, watched: true},
30-
{pattern: 'built/test/matchers.js', included: true, watched: true},
32+
{ pattern: 'karma-test-shim.js', included: true, watched: true },
3133

3234
// paths loaded via module imports
3335
// Angular itself
34-
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: true},
35-
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true},
36+
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: true },
37+
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true },
3638

37-
{pattern: 'node_modules/firebase/firebase.js', included: false, watched: false},
38-
{pattern: 'dist/**/*.js', included: false, watched: true},
39-
{pattern: 'dist/**/*.js.map', included: false, watched: false}
39+
{ pattern: 'node_modules/firebase/firebase.js', included: false, watched: false },
40+
{ pattern: 'dist/**/*.js', included: false, watched: true },
41+
{ pattern: 'dist/**/*.js.map', included: false, watched: false }
4042
],
4143

4244
port: 9876,

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
},
3333
"homepage": "https://github.com/angular/angularfire2#readme",
3434
"dependencies": {
35-
"@angular/common": "^2.0.0-rc.5",
36-
"@angular/compiler": "^2.0.0-rc.5",
37-
"@angular/core": "^2.0.0-rc.5",
38-
"@angular/platform-browser": "^2.0.0-rc.5",
39-
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
40-
"firebase": "^3.0.3",
41-
"rxjs": "5.0.0-beta.6"
35+
"@angular/common": "^2.0.0-rc.7",
36+
"@angular/compiler": "^2.0.0-rc.7",
37+
"@angular/core": "^2.0.0-rc.7",
38+
"@angular/platform-browser": "^2.0.0-rc.7",
39+
"@angular/platform-browser-dynamic": "^2.0.0-rc.7",
40+
"@types/request": "0.0.30",
41+
"firebase": "3.3.0",
42+
"rxjs": "5.0.0-beta.12"
4243
},
4344
"devDependencies": {
4445
"@angular/compiler-cli": "^0.5.0",
@@ -70,7 +71,7 @@
7071
"typedoc": "github:jeffbcross/typedoc",
7172
"typescript": "next",
7273
"typings": "^1.3.2",
73-
"zone.js": "^0.6.6"
74+
"zone.js": "^0.6.21"
7475
},
7576
"typings": "dist/angularfire2.d.ts"
7677
}

src/angularfire2.spec.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
2-
addProviders,
2+
TestBed,
33
inject
44
} from '@angular/core/testing';
5-
import { ReflectiveInjector, provide, Provider } from '@angular/core';
5+
import { ReflectiveInjector, Provider } from '@angular/core';
66
import {
77
AngularFire,
88
FirebaseObjectObservable,
@@ -12,21 +12,16 @@ import {
1212
FirebaseApp,
1313
defaultFirebase,
1414
AngularFireDatabase,
15-
FirebaseAppConfig
15+
FirebaseAppConfig,
16+
AngularFireModule
1617
} from './angularfire2';
1718
import { Subscription } from 'rxjs/Subscription';
19+
import { COMMON_CONFIG, ANON_AUTH_CONFIG } from './test-config';
1820
import 'rxjs/add/operator/toPromise';
1921
import 'rxjs/add/operator/take';
2022
import 'rxjs/add/operator/do';
2123
import 'rxjs/add/operator/delay';
2224

23-
export const firebaseConfig: FirebaseAppConfig = {
24-
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
25-
authDomain: "angularfire2-test.firebaseapp.com",
26-
databaseURL: "https://angularfire2-test.firebaseio.com",
27-
storageBucket: "angularfire2-test.appspot.com",
28-
};
29-
3025
describe('angularfire', () => {
3126
var subscription:Subscription;
3227
var app: firebase.app.App;
@@ -36,7 +31,11 @@ describe('angularfire', () => {
3631
var angularFire2: AngularFire;
3732

3833
beforeEach(() => {
39-
addProviders([FIREBASE_PROVIDERS, defaultFirebase(firebaseConfig)]);
34+
35+
TestBed.configureTestingModule({
36+
imports: [AngularFireModule.initializeApp(COMMON_CONFIG, ANON_AUTH_CONFIG)]
37+
});
38+
4039
inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => {
4140
angularFire2 = _af;
4241
app = firebaseApp;
@@ -48,7 +47,7 @@ describe('angularfire', () => {
4847

4948
afterEach((done) => {
5049
rootRef.remove()
51-
if(subscription && !subscription.isUnsubscribed) {
50+
if(subscription && !subscription.closed) {
5251
subscription.unsubscribe();
5352
}
5453
app.delete().then(done, done.fail);
@@ -80,7 +79,7 @@ describe('angularfire', () => {
8079

8180
describe('defaultFirebase', () => {
8281
it('should create an array of providers', () => {
83-
const providers = defaultFirebase(firebaseConfig);
82+
const providers = defaultFirebase(COMMON_CONFIG);
8483
expect(providers.length).toBe(2);
8584
});
8685
});

src/angularfire2.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
Inject,
1919
Injectable,
2020
OpaqueToken,
21-
provide,
2221
NgModule,
2322
ModuleWithProviders
2423
} from '@angular/core';
@@ -44,7 +43,7 @@ import {
4443
@Injectable()
4544
export class AngularFire {
4645
constructor(
47-
@Inject(FirebaseConfig) private fbUrl:string,
46+
@Inject(FirebaseConfig) private firebaseConfig:string,
4847
public auth: AngularFireAuth,
4948
public database: AngularFireDatabase) {}
5049
}

src/auth/auth.spec.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { auth, initializeApp } from 'firebase';
2-
import { ReflectiveInjector, provide, Provider } from '@angular/core';
2+
import { ReflectiveInjector, Provider } from '@angular/core';
33
import { Observable } from 'rxjs/Observable'
44
import { Observer } from 'rxjs/Observer';
55
import {
6-
addProviders,
6+
TestBed,
77
inject
88
} from '@angular/core/testing';
99
import 'rxjs/add/operator/do';
@@ -19,9 +19,10 @@ import {
1919
AuthMethods,
2020
firebaseAuthConfig,
2121
AuthProviders,
22-
WindowLocation
22+
WindowLocation,
23+
AngularFireModule
2324
} from '../angularfire2';
24-
import { COMMON_CONFIG } from '../test-config';
25+
import { COMMON_CONFIG, ANON_AUTH_CONFIG } from '../test-config';
2526

2627
import { AuthBackend } from './auth_backend';
2728
import { FirebaseSdkAuthBackend } from './firebase_sdk_auth_backend';
@@ -131,19 +132,25 @@ describe('FirebaseAuth', () => {
131132
origin:'localhost',
132133
href:'https://localhost/'
133134
};
134-
addProviders([
135-
FIREBASE_PROVIDERS,
136-
defaultFirebase(COMMON_CONFIG),
137-
{ provide: FirebaseApp,
138-
useFactory: (config: FirebaseAppConfig) => {
139-
var app = initializeApp(config);
140-
(<any>app).auth = () => authSpy;
141-
return app;
135+
136+
TestBed.configureTestingModule({
137+
imports: [AngularFireModule.initializeApp(COMMON_CONFIG, ANON_AUTH_CONFIG)],
138+
providers: [
139+
{
140+
provide: FirebaseApp,
141+
useFactory: (config: FirebaseAppConfig) => {
142+
var app = initializeApp(config);
143+
(<any>app).auth = () => authSpy;
144+
return app;
145+
},
146+
deps: [FirebaseConfig]
142147
},
143-
deps: [FirebaseConfig]
144-
},
145-
{ provide: WindowLocation, useValue: windowLocation }
146-
]);
148+
{
149+
provide: WindowLocation,
150+
useValue: windowLocation
151+
}
152+
]
153+
});
147154

148155
authSpy = jasmine.createSpyObj('auth', authMethods);
149156
authSpy['createUserWithEmailAndPassword'].and.returnValue(Promise.resolve(firebaseUser));

src/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Provider, Inject, provide, Injectable, Optional } from '@angular/core';
1+
import { Provider, Inject, Injectable, Optional } from '@angular/core';
22
import { Observable } from 'rxjs/Observable';
33
import { Observer } from 'rxjs/Observer';
44
import { ReplaySubject } from 'rxjs/ReplaySubject';

0 commit comments

Comments
 (0)