16
16
*/
17
17
18
18
describe ( '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
-
57
19
describe ( 'fetch()' , function ( ) {
58
20
it ( 'with expiration provided' , async function ( ) {
59
21
const date = Date . now ( ) - 30000 ;
@@ -73,15 +35,6 @@ describe('remoteConfig()', function () {
73
35
it ( 'without expiration provided' , function ( ) {
74
36
return firebase . remoteConfig ( ) . fetch ( ) ;
75
37
} ) ;
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
- } ) ;
85
38
} ) ;
86
39
87
40
describe ( 'fetchAndActivate()' , function ( ) {
@@ -114,50 +67,17 @@ describe('remoteConfig()', function () {
114
67
} ) ;
115
68
116
69
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
-
128
70
it ( 'minimumFetchIntervalMillis sets correctly' , async function ( ) {
129
71
await firebase . remoteConfig ( ) . setConfigSettings ( { minimumFetchIntervalMillis : 3000 } ) ;
130
72
131
73
firebase . remoteConfig ( ) . settings . minimumFetchIntervalMillis . should . be . equal ( 3000 ) ;
132
74
} ) ;
133
75
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
-
145
76
it ( 'fetchTimeMillis sets correctly' , async function ( ) {
146
77
await firebase . remoteConfig ( ) . setConfigSettings ( { fetchTimeMillis : 3000 } ) ;
147
78
148
79
firebase . remoteConfig ( ) . settings . fetchTimeMillis . should . be . equal ( 3000 ) ;
149
80
} ) ;
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
- } ) ;
161
81
} ) ;
162
82
163
83
describe ( 'ensureInitialized()' , function ( ) {
@@ -201,16 +121,6 @@ describe('remoteConfig()', function () {
201
121
values . some_key_1 . getSource ( ) . should . equal ( 'default' ) ;
202
122
values . some_key_2 . getSource ( ) . should . equal ( 'default' ) ;
203
123
} ) ;
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
- } ) ;
214
124
} ) ;
215
125
216
126
describe ( 'getValue()' , function ( ) {
@@ -376,16 +286,6 @@ describe('remoteConfig()', function () {
376
286
error . code . should . equal ( 'remoteConfig/resource_not_found' ) ;
377
287
error . message . should . containEql ( 'was not found' ) ;
378
288
} ) ;
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
- } ) ;
389
289
} ) ;
390
290
391
291
describe ( 'reset()' , function ( ) {
0 commit comments