1616 */
1717
1818describe ( 'remoteConfig()' , function ( ) {
19- describe ( 'namespace' , function ( ) {
20- it ( 'accessible from firebase.app()' , function ( ) {
21- const app = firebase . app ( ) ;
22- should . exist ( app . remoteConfig ) ;
23- app . remoteConfig ( ) . app . should . equal ( app ) ;
24- } ) ;
25-
26- it ( 'supports multiple apps' , async function ( ) {
27- firebase . firestore ( ) . app . name . should . equal ( '[DEFAULT]' ) ;
28-
29- firebase
30- . firestore ( firebase . app ( 'secondaryFromNative' ) )
31- . app . name . should . equal ( 'secondaryFromNative' ) ;
32-
33- firebase
34- . app ( 'secondaryFromNative' )
35- . remoteConfig ( )
36- . app . name . should . equal ( 'secondaryFromNative' ) ;
37- } ) ;
38- } ) ;
39-
40- describe ( 'statics' , function ( ) {
41- it ( 'LastFetchStatus' , function ( ) {
42- firebase . remoteConfig . LastFetchStatus . should . be . an . Object ( ) ;
43- firebase . remoteConfig . LastFetchStatus . FAILURE . should . equal ( 'failure' ) ;
44- firebase . remoteConfig . LastFetchStatus . SUCCESS . should . equal ( 'success' ) ;
45- firebase . remoteConfig . LastFetchStatus . NO_FETCH_YET . should . equal ( 'no_fetch_yet' ) ;
46- firebase . remoteConfig . LastFetchStatus . THROTTLED . should . equal ( 'throttled' ) ;
47- } ) ;
48-
49- it ( 'ValueSource' , function ( ) {
50- firebase . remoteConfig . ValueSource . should . be . an . Object ( ) ;
51- firebase . remoteConfig . ValueSource . REMOTE . should . equal ( 'remote' ) ;
52- firebase . remoteConfig . ValueSource . STATIC . should . equal ( 'static' ) ;
53- firebase . remoteConfig . ValueSource . DEFAULT . should . equal ( 'default' ) ;
54- } ) ;
55- } ) ;
56-
5719 describe ( 'fetch()' , function ( ) {
5820 it ( 'with expiration provided' , async function ( ) {
5921 const date = Date . now ( ) - 30000 ;
@@ -73,15 +35,6 @@ describe('remoteConfig()', function () {
7335 it ( 'without expiration provided' , function ( ) {
7436 return firebase . remoteConfig ( ) . fetch ( ) ;
7537 } ) ;
76- it ( 'it throws if expiration is not a number' , function ( ) {
77- try {
78- firebase . remoteConfig ( ) . fetch ( 'foo' ) ;
79- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
80- } catch ( error ) {
81- error . message . should . containEql ( 'must be a number value' ) ;
82- return Promise . resolve ( ) ;
83- }
84- } ) ;
8538 } ) ;
8639
8740 describe ( 'fetchAndActivate()' , function ( ) {
@@ -114,50 +67,17 @@ describe('remoteConfig()', function () {
11467 } ) ;
11568
11669 describe ( 'setConfigSettings()' , function ( ) {
117- it ( 'it throws if arg is not an object' , async function ( ) {
118- try {
119- firebase . remoteConfig ( ) . setConfigSettings ( 'not an object' ) ;
120-
121- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
122- } catch ( error ) {
123- error . message . should . containEql ( 'must set an object' ) ;
124- return Promise . resolve ( ) ;
125- }
126- } ) ;
127-
12870 it ( 'minimumFetchIntervalMillis sets correctly' , async function ( ) {
12971 await firebase . remoteConfig ( ) . setConfigSettings ( { minimumFetchIntervalMillis : 3000 } ) ;
13072
13173 firebase . remoteConfig ( ) . settings . minimumFetchIntervalMillis . should . be . equal ( 3000 ) ;
13274 } ) ;
13375
134- it ( 'throws if minimumFetchIntervalMillis is not a number' , async function ( ) {
135- try {
136- firebase . remoteConfig ( ) . setConfigSettings ( { minimumFetchIntervalMillis : 'potato' } ) ;
137-
138- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
139- } catch ( error ) {
140- error . message . should . containEql ( 'must be a number type in milliseconds.' ) ;
141- return Promise . resolve ( ) ;
142- }
143- } ) ;
144-
14576 it ( 'fetchTimeMillis sets correctly' , async function ( ) {
14677 await firebase . remoteConfig ( ) . setConfigSettings ( { fetchTimeMillis : 3000 } ) ;
14778
14879 firebase . remoteConfig ( ) . settings . fetchTimeMillis . should . be . equal ( 3000 ) ;
14980 } ) ;
150-
151- it ( 'throws if fetchTimeMillis is not a number' , function ( ) {
152- try {
153- firebase . remoteConfig ( ) . setConfigSettings ( { fetchTimeMillis : 'potato' } ) ;
154-
155- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
156- } catch ( error ) {
157- error . message . should . containEql ( 'must be a number type in milliseconds.' ) ;
158- return Promise . resolve ( ) ;
159- }
160- } ) ;
16181 } ) ;
16282
16383 describe ( 'ensureInitialized()' , function ( ) {
@@ -201,16 +121,6 @@ describe('remoteConfig()', function () {
201121 values . some_key_1 . getSource ( ) . should . equal ( 'default' ) ;
202122 values . some_key_2 . getSource ( ) . should . equal ( 'default' ) ;
203123 } ) ;
204-
205- it ( 'it throws if defaults object not provided' , function ( ) {
206- try {
207- firebase . remoteConfig ( ) . setDefaults ( 'not an object' ) ;
208- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
209- } catch ( error ) {
210- error . message . should . containEql ( 'must be an object.' ) ;
211- return Promise . resolve ( ) ;
212- }
213- } ) ;
214124 } ) ;
215125
216126 describe ( 'getValue()' , function ( ) {
@@ -376,16 +286,6 @@ describe('remoteConfig()', function () {
376286 error . code . should . equal ( 'remoteConfig/resource_not_found' ) ;
377287 error . message . should . containEql ( 'was not found' ) ;
378288 } ) ;
379-
380- it ( 'throws if resourceName is not a string' , function ( ) {
381- try {
382- firebase . remoteConfig ( ) . setDefaultsFromResource ( 1337 ) ;
383- return Promise . reject ( new Error ( 'Did not throw' ) ) ;
384- } catch ( error ) {
385- error . message . should . containEql ( 'must be a string value' ) ;
386- return Promise . resolve ( ) ;
387- }
388- } ) ;
389289 } ) ;
390290
391291 describe ( 'reset()' , function ( ) {
0 commit comments