@@ -37,24 +37,10 @@ describe('firebase', function () {
37
37
should . equal ( firebase . app ( ) . options . storageBucket , platformAppConfig . storageBucket ) ;
38
38
} ) ;
39
39
40
- xit ( 'it should initialize dynamic apps' , function ( ) {
41
- const name = `testscoreapp${ FirebaseHelpers . id } ` ;
42
- const platformAppConfig = FirebaseHelpers . app . config ( ) ;
43
- return firebase . initializeApp ( platformAppConfig , name ) . then ( newApp => {
44
- newApp . name . should . equal ( name ) ;
45
- newApp . toString ( ) . should . equal ( name ) ;
46
- newApp . options . apiKey . should . equal ( platformAppConfig . apiKey ) ;
47
- return newApp . delete ( ) ;
48
- } ) ;
49
- } ) ;
50
-
51
40
it ( 'SDK_VERSION should return a string version' , function ( ) {
52
41
firebase . SDK_VERSION . should . be . a . String ( ) ;
53
42
} ) ;
54
- } ) ;
55
43
56
- // eslint-disable-next-line mocha/max-top-level-suites
57
- describe ( 'firebase -> X' , function ( ) {
58
44
it ( 'apps should provide an array of apps' , function ( ) {
59
45
should . equal ( ! ! firebase . apps . length , true ) ;
60
46
should . equal ( firebase . apps . includes ( firebase . app ( '[DEFAULT]' ) ) , true ) ;
@@ -66,31 +52,55 @@ describe('firebase -> X', function () {
66
52
should . equal ( firebase . app ( ) . automaticDataCollectionEnabled , false ) ;
67
53
} ) ;
68
54
69
- xit ( 'apps can be deleted ', async function ( ) {
55
+ it ( 'it should initialize dynamic apps ', async function ( ) {
70
56
const name = `testscoreapp${ FirebaseHelpers . id } ` ;
71
57
const platformAppConfig = FirebaseHelpers . app . config ( ) ;
72
58
const newApp = await firebase . initializeApp ( platformAppConfig , name ) ;
73
-
74
59
newApp . name . should . equal ( name ) ;
75
60
newApp . toString ( ) . should . equal ( name ) ;
76
61
newApp . options . apiKey . should . equal ( platformAppConfig . apiKey ) ;
62
+ return newApp . delete ( ) ;
63
+ } ) ;
77
64
78
- await newApp . delete ( ) ;
65
+ it ( 'should error if dynamic app initialization values are incorrect' , async function ( ) {
66
+ try {
67
+ await firebase . initializeApp ( { appId : 'myid' } , 'myname' ) ;
68
+ throw new Error ( 'Should have rejected incorrect initializeApp input' ) ;
69
+ } catch ( e ) {
70
+ e . message . should . equal ( "Missing or invalid FirebaseOptions property 'apiKey'." ) ;
71
+ }
72
+ } ) ;
79
73
80
- ( ( ) => {
81
- newApp . delete ( ) ;
82
- } ) . should . throw ( `Firebase App named '${ name } ' already deleted` ) ;
74
+ it ( 'apps can be deleted, but only once' , async function ( ) {
75
+ const name = `testscoreapp${ FirebaseHelpers . id } ` ;
76
+ const platformAppConfig = FirebaseHelpers . app . config ( ) ;
77
+ const newApp = await firebase . initializeApp ( platformAppConfig , name ) ;
83
78
84
- ( ( ) => {
79
+ newApp . name . should . equal ( name ) ;
80
+ newApp . toString ( ) . should . equal ( name ) ;
81
+ newApp . options . apiKey . should . equal ( platformAppConfig . apiKey ) ;
82
+
83
+ await newApp . delete ( ) ;
84
+ try {
85
+ await newApp . delete ( ) ;
86
+ } catch ( e ) {
87
+ e . message . should . equal ( `Firebase App named '${ name } ' already deleted` ) ;
88
+ }
89
+ try {
85
90
firebase . app ( name ) ;
86
- } ) . should . throw ( `No Firebase App '${ name } ' has been created - call firebase.initializeApp()` ) ;
91
+ } catch ( e ) {
92
+ e . message . should . equal (
93
+ `No Firebase App '${ name } ' has been created - call firebase.initializeApp()` ,
94
+ ) ;
95
+ }
87
96
} ) ;
88
97
89
- xit ( 'prevents the default app from being deleted' , async function ( ) {
90
- firebase
91
- . app ( )
92
- . delete ( )
93
- . should . be . rejectedWith ( 'Unable to delete the default native firebase app instance.' ) ;
98
+ it ( 'prevents the default app from being deleted' , async function ( ) {
99
+ try {
100
+ await firebase . app ( ) . delete ( ) ;
101
+ } catch ( e ) {
102
+ e . message . should . equal ( 'Unable to delete the default native firebase app instance.' ) ;
103
+ }
94
104
} ) ;
95
105
96
106
it ( 'extendApp should provide additional functionality' , function ( ) {
0 commit comments