@@ -239,16 +239,85 @@ describe('api', () => {
239239 expect ( getStateReference ( app ) . activated ) . to . equal ( true ) ;
240240 } ) ;
241241
242- it ( 'isTokenAutoRefreshEnabled value defaults to global setting ' , ( ) => {
242+ it ( 'global false + local unset = false ' , ( ) => {
243243 app . automaticDataCollectionEnabled = false ;
244244 initializeAppCheck ( app , {
245245 provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY )
246246 } ) ;
247247 expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
248248 } ) ;
249249
250- it ( 'sets isTokenAutoRefreshEnabled correctly, overriding global setting ' , ( ) => {
250+ it ( 'global false + local true = false ' , ( ) => {
251251 app . automaticDataCollectionEnabled = false ;
252+ initializeAppCheck ( app , {
253+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
254+ isTokenAutoRefreshEnabled : true
255+ } ) ;
256+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
257+ } ) ;
258+
259+ it ( 'global false + local false = false' , ( ) => {
260+ app . automaticDataCollectionEnabled = false ;
261+ initializeAppCheck ( app , {
262+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
263+ isTokenAutoRefreshEnabled : false
264+ } ) ;
265+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
266+ } ) ;
267+
268+ it ( 'global unset + local unset = false' , ( ) => {
269+ // Global unset should default to true.
270+ initializeAppCheck ( app , {
271+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY )
272+ } ) ;
273+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
274+ } ) ;
275+
276+ it ( 'global unset + local false = false' , ( ) => {
277+ // Global unset should default to true.
278+ initializeAppCheck ( app , {
279+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
280+ isTokenAutoRefreshEnabled : false
281+ } ) ;
282+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
283+ } ) ;
284+
285+ it ( 'global unset + local true = true' , ( ) => {
286+ // Global unset should default to true.
287+ initializeAppCheck ( app , {
288+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
289+ isTokenAutoRefreshEnabled : true
290+ } ) ;
291+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( true ) ;
292+ } ) ;
293+
294+ it ( 'global true + local unset = false' , ( ) => {
295+ app . automaticDataCollectionEnabled = true ;
296+ initializeAppCheck ( app , {
297+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY )
298+ } ) ;
299+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
300+ } ) ;
301+
302+ it ( 'global true + local false = false' , ( ) => {
303+ app . automaticDataCollectionEnabled = true ;
304+ initializeAppCheck ( app , {
305+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
306+ isTokenAutoRefreshEnabled : false
307+ } ) ;
308+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( false ) ;
309+ } ) ;
310+
311+ it ( 'global true + local true = true' , ( ) => {
312+ app . automaticDataCollectionEnabled = true ;
313+ initializeAppCheck ( app , {
314+ provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
315+ isTokenAutoRefreshEnabled : true
316+ } ) ;
317+ expect ( getStateReference ( app ) . isTokenAutoRefreshEnabled ) . to . equal ( true ) ;
318+ } ) ;
319+
320+ it ( 'sets isTokenAutoRefreshEnabled correctly, overriding global setting' , ( ) => {
252321 initializeAppCheck ( app , {
253322 provider : new ReCaptchaV3Provider ( FAKE_SITE_KEY ) ,
254323 isTokenAutoRefreshEnabled : true
0 commit comments