Skip to content

Commit 2f9b234

Browse files
committed
test(e2e): fix typescript config and build of examples
1 parent 51c8caa commit 2f9b234

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js",
1414
"build_bundle": "cp -r src angularfire2 && tsc typings/main.d.ts angularfire2.ts --rootDir . --module system -t es5 --outFile dist/bundles/angularfire2.js --moduleResolution node --emitDecoratorMetadata --experimentalDecorators",
1515
"e2e_test": "webdriver-manager update && npm run build_e2e && protractor",
16-
"build_e2e": "npm run build && tsc -p test/ && cp test/e2e/firebase_object/index.html dist-test/e2e/firebase_object/ && cp test/e2e/firebase_list/index.html dist-test/e2e/firebase_list/ && cp test/e2e/auth/index.html dist-test/e2e/auth/"
16+
"build_e2e": "rm -rf dist-test && npm run build && tsc -p test/ && cp test/e2e/firebase_object/index.html dist-test/e2e/firebase_object/ && cp test/e2e/firebase_list/index.html dist-test/e2e/firebase_list/ && cp test/e2e/auth/index.html dist-test/e2e/auth/"
1717
},
1818
"keywords": [
1919
"angular2",

test/e2e/auth/firebase_auth_example.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,23 @@ import {
77
AngularFire,
88
FIREBASE_PROVIDERS,
99
FirebaseListObservable,
10+
FirebaseAuthState,
1011
FirebaseApp
11-
} from '../../../dist/angularfire2';
12+
} from 'angularfire2';
1213

1314
enableProdMode();
1415

15-
import { COMMON_CONFIG } from '../../../src/test-config';
16+
// TODO fix imports and tsconfig
17+
// import { COMMON_CONFIG } from 'angularfire2/test-config';
18+
19+
import 'rxjs/add/operator/do';
20+
21+
const COMMON_CONFIG = {
22+
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
23+
authDomain: "angularfire2-test.firebaseapp.com",
24+
databaseURL: "https://angularfire2-test.firebaseio.com",
25+
storageBucket: "angularfire2-test.appspot.com"
26+
};
1627

1728
@Component({
1829
template: `
@@ -80,18 +91,27 @@ import { COMMON_CONFIG } from '../../../src/test-config';
8091
{{ user?.providerData && user.providerData[0] | json }}
8192
<span *ngIf="!user || !user.providerData">Not Logged In</span>
8293
</blockquote>
94+
95+
<blockquote>
96+
<h2>User</h2>
97+
(Empty object is equivalent to null).
98+
{{ user || {} | json }}
99+
</blockquote>
83100
`,
84101
selector: 'app'
85102
})
86103
class App {
87-
user: any;
104+
user: FirebaseAuthState;
88105
questions: FirebaseListObservable<any>;
89106
constructor(public af: AngularFire) {
90107
af.auth
91-
.subscribe(user => {
92-
console.log('onAuth', user);
93-
this.user = user
94-
});
108+
.do(v => console.log('onAuth', v))
109+
.map(u => {
110+
return Object.assign({}, u, {
111+
auth: null // makes easier to convert to json
112+
})
113+
})
114+
.subscribe(user => this.user = user);
95115
}
96116

97117
signInAnonymously() {

test/e2e/firebase_list/firebase_list_example.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import {
1010

1111
enableProdMode();
1212

13-
import { COMMON_CONFIG } from '../../../src/test-config';
13+
// TODO fix imports and tsconfig
14+
// import { COMMON_CONFIG } from '../../../src/test-config';
15+
16+
const COMMON_CONFIG = {
17+
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
18+
authDomain: "angularfire2-test.firebaseapp.com",
19+
databaseURL: "https://angularfire2-test.firebaseio.com",
20+
storageBucket: "angularfire2-test.appspot.com",
21+
};
1422

1523
@Component({
1624
template: `

test/e2e/firebase_object/firebase_object_example.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ import {
88
FirebaseApp
99
} from 'angularfire2';
1010

11-
import { COMMON_CONFIG } from '../../../src/test-config';
11+
// TODO fix imports and tsconfig
12+
// import { COMMON_CONFIG } from '../../../src/test-config';
13+
14+
const COMMON_CONFIG = {
15+
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
16+
authDomain: "angularfire2-test.firebaseapp.com",
17+
databaseURL: "https://angularfire2-test.firebaseio.com",
18+
storageBucket: "angularfire2-test.appspot.com",
19+
};
20+
1221

1322
enableProdMode();
1423

test/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
"declaration": true,
1010
"removeComments": true,
1111
"baseUrl": ".",
12+
"rootDir": ".",
1213
"outDir": "../dist-test",
1314
"paths": {
1415
"angularfire2": [
1516
"../dist/*",
1617
"../dist/angularfire2.d.ts"
17-
],
18-
"test/config": [
19-
"./config.ts"
2018
]
2119
}
2220
}

0 commit comments

Comments
 (0)