Skip to content

Commit

Permalink
feat: upgrade to RC7 (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast authored and jeffbcross committed Sep 15, 2016
1 parent 1eb449a commit 2410b2d
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 148 deletions.
52 changes: 25 additions & 27 deletions karma-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,31 @@ System.config({

System.config(
{
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
map: {
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular',
firebase: 'node_modules/firebase/firebase.js',
'app': 'dist'
'app': 'dist',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',

// angular testing umd bundles
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',

// other libraries
'rxjs': 'npm:rxjs',
'firebase': 'npm:firebase/firebase.js'
},
packages: {
'app': {
main: 'main.js',
defaultExtension: 'js'
},
'@angular/core': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/compiler': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/common': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser': {
main: 'index.js',
defaultExtension: 'js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js',
defaultExtension: 'js'
},
'rxjs': {
Expand All @@ -75,8 +71,10 @@ Promise.all([
var testing = providers[0];
var testingBrowser = providers[1];

testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
testing.TestBed.initTestEnvironment(
testingBrowser.BrowserDynamicTestingModule,
testingBrowser.platformBrowserDynamicTesting()
);

}).then(function() {
// Finally, load all spec files.
Expand Down
16 changes: 9 additions & 7 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,27 @@ module.exports = function(config) {

// Zone.js dependencies
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',

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


{pattern: 'karma-test-shim.js', included: true, watched: true},
{pattern: 'built/test/matchers.js', included: true, watched: true},
{ pattern: 'karma-test-shim.js', included: true, watched: true },

// paths loaded via module imports
// Angular itself
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: true},
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true},
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: true },
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true },

{pattern: 'node_modules/firebase/firebase.js', included: false, watched: false},
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
{ pattern: 'node_modules/firebase/firebase.js', included: false, watched: false },
{ pattern: 'dist/**/*.js', included: false, watched: true },
{ pattern: 'dist/**/*.js.map', included: false, watched: false }
],

port: 9876,
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
},
"homepage": "https://github.com/angular/angularfire2#readme",
"dependencies": {
"@angular/common": "^2.0.0-rc.5",
"@angular/compiler": "^2.0.0-rc.5",
"@angular/core": "^2.0.0-rc.5",
"@angular/platform-browser": "^2.0.0-rc.5",
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
"firebase": "^3.0.3",
"rxjs": "5.0.0-beta.6"
"@angular/common": "^2.0.0-rc.7",
"@angular/compiler": "^2.0.0-rc.7",
"@angular/core": "^2.0.0-rc.7",
"@angular/platform-browser": "^2.0.0-rc.7",
"@angular/platform-browser-dynamic": "^2.0.0-rc.7",
"@types/request": "0.0.30",
"firebase": "3.3.0",
"rxjs": "5.0.0-beta.12"
},
"devDependencies": {
"@angular/compiler-cli": "^0.5.0",
Expand Down Expand Up @@ -70,7 +71,7 @@
"typedoc": "github:jeffbcross/typedoc",
"typescript": "next",
"typings": "^1.3.2",
"zone.js": "^0.6.6"
"zone.js": "^0.6.21"
},
"typings": "dist/angularfire2.d.ts"
}
25 changes: 12 additions & 13 deletions src/angularfire2.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
addProviders,
TestBed,
inject
} from '@angular/core/testing';
import { ReflectiveInjector, provide, Provider } from '@angular/core';
import { ReflectiveInjector, Provider } from '@angular/core';
import {
AngularFire,
FirebaseObjectObservable,
Expand All @@ -12,21 +12,16 @@ import {
FirebaseApp,
defaultFirebase,
AngularFireDatabase,
FirebaseAppConfig
FirebaseAppConfig,
AngularFireModule
} from './angularfire2';
import { Subscription } from 'rxjs/Subscription';
import { COMMON_CONFIG, ANON_AUTH_CONFIG } from './test-config';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/take';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/delay';

export const firebaseConfig: FirebaseAppConfig = {
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
authDomain: "angularfire2-test.firebaseapp.com",
databaseURL: "https://angularfire2-test.firebaseio.com",
storageBucket: "angularfire2-test.appspot.com",
};

describe('angularfire', () => {
var subscription:Subscription;
var app: firebase.app.App;
Expand All @@ -36,7 +31,11 @@ describe('angularfire', () => {
var angularFire2: AngularFire;

beforeEach(() => {
addProviders([FIREBASE_PROVIDERS, defaultFirebase(firebaseConfig)]);

TestBed.configureTestingModule({
imports: [AngularFireModule.initializeApp(COMMON_CONFIG, ANON_AUTH_CONFIG)]
});

inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => {
angularFire2 = _af;
app = firebaseApp;
Expand All @@ -48,7 +47,7 @@ describe('angularfire', () => {

afterEach((done) => {
rootRef.remove()
if(subscription && !subscription.isUnsubscribed) {
if(subscription && !subscription.closed) {
subscription.unsubscribe();
}
app.delete().then(done, done.fail);
Expand Down Expand Up @@ -80,7 +79,7 @@ describe('angularfire', () => {

describe('defaultFirebase', () => {
it('should create an array of providers', () => {
const providers = defaultFirebase(firebaseConfig);
const providers = defaultFirebase(COMMON_CONFIG);
expect(providers.length).toBe(2);
});
});
Expand Down
3 changes: 1 addition & 2 deletions src/angularfire2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
Inject,
Injectable,
OpaqueToken,
provide,
NgModule,
ModuleWithProviders
} from '@angular/core';
Expand All @@ -44,7 +43,7 @@ import {
@Injectable()
export class AngularFire {
constructor(
@Inject(FirebaseConfig) private fbUrl:string,
@Inject(FirebaseConfig) private firebaseConfig:string,
public auth: AngularFireAuth,
public database: AngularFireDatabase) {}
}
Expand Down
39 changes: 23 additions & 16 deletions src/auth/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { auth, initializeApp } from 'firebase';
import { ReflectiveInjector, provide, Provider } from '@angular/core';
import { ReflectiveInjector, Provider } from '@angular/core';
import { Observable } from 'rxjs/Observable'
import { Observer } from 'rxjs/Observer';
import {
addProviders,
TestBed,
inject
} from '@angular/core/testing';
import 'rxjs/add/operator/do';
Expand All @@ -19,9 +19,10 @@ import {
AuthMethods,
firebaseAuthConfig,
AuthProviders,
WindowLocation
WindowLocation,
AngularFireModule
} from '../angularfire2';
import { COMMON_CONFIG } from '../test-config';
import { COMMON_CONFIG, ANON_AUTH_CONFIG } from '../test-config';

import { AuthBackend } from './auth_backend';
import { FirebaseSdkAuthBackend } from './firebase_sdk_auth_backend';
Expand Down Expand Up @@ -131,19 +132,25 @@ describe('FirebaseAuth', () => {
origin:'localhost',
href:'https://localhost/'
};
addProviders([
FIREBASE_PROVIDERS,
defaultFirebase(COMMON_CONFIG),
{ provide: FirebaseApp,
useFactory: (config: FirebaseAppConfig) => {
var app = initializeApp(config);
(<any>app).auth = () => authSpy;
return app;

TestBed.configureTestingModule({
imports: [AngularFireModule.initializeApp(COMMON_CONFIG, ANON_AUTH_CONFIG)],
providers: [
{
provide: FirebaseApp,
useFactory: (config: FirebaseAppConfig) => {
var app = initializeApp(config);
(<any>app).auth = () => authSpy;
return app;
},
deps: [FirebaseConfig]
},
deps: [FirebaseConfig]
},
{ provide: WindowLocation, useValue: windowLocation }
]);
{
provide: WindowLocation,
useValue: windowLocation
}
]
});

authSpy = jasmine.createSpyObj('auth', authMethods);
authSpy['createUserWithEmailAndPassword'].and.returnValue(Promise.resolve(firebaseUser));
Expand Down
2 changes: 1 addition & 1 deletion src/auth/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, Inject, provide, Injectable, Optional } from '@angular/core';
import { Provider, Inject, Injectable, Optional } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { ReplaySubject } from 'rxjs/ReplaySubject';
Expand Down
Loading

0 comments on commit 2410b2d

Please sign in to comment.