@@ -37,24 +37,10 @@ describe('firebase', function () {
3737 should . equal ( firebase . app ( ) . options . storageBucket , platformAppConfig . storageBucket ) ;
3838 } ) ;
3939
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-
5140 it ( 'SDK_VERSION should return a string version' , function ( ) {
5241 firebase . SDK_VERSION . should . be . a . String ( ) ;
5342 } ) ;
54- } ) ;
5543
56- // eslint-disable-next-line mocha/max-top-level-suites
57- describe ( 'firebase -> X' , function ( ) {
5844 it ( 'apps should provide an array of apps' , function ( ) {
5945 should . equal ( ! ! firebase . apps . length , true ) ;
6046 should . equal ( firebase . apps . includes ( firebase . app ( '[DEFAULT]' ) ) , true ) ;
@@ -66,31 +52,55 @@ describe('firebase -> X', function () {
6652 should . equal ( firebase . app ( ) . automaticDataCollectionEnabled , false ) ;
6753 } ) ;
6854
69- xit ( 'apps can be deleted ', async function ( ) {
55+ it ( 'it should initialize dynamic apps ', async function ( ) {
7056 const name = `testscoreapp${ FirebaseHelpers . id } ` ;
7157 const platformAppConfig = FirebaseHelpers . app . config ( ) ;
7258 const newApp = await firebase . initializeApp ( platformAppConfig , name ) ;
73-
7459 newApp . name . should . equal ( name ) ;
7560 newApp . toString ( ) . should . equal ( name ) ;
7661 newApp . options . apiKey . should . equal ( platformAppConfig . apiKey ) ;
62+ return newApp . delete ( ) ;
63+ } ) ;
7764
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+ } ) ;
7973
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 ) ;
8378
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 {
8590 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+ }
8796 } ) ;
8897
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+ }
94104 } ) ;
95105
96106 it ( 'extendApp should provide additional functionality' , function ( ) {
0 commit comments