@@ -330,13 +330,14 @@ describe('AtlasAiService', function () {
330
330
} ) ;
331
331
} ) ;
332
332
333
- if ( apiURLPreset === 'cloud' ) {
334
- it ( 'should make a POST request to cloud endpoint and save preference when cloud preset' , async function ( ) {
335
- const fetchStub = sandbox . stub ( ) . resolves ( makeResponse ( { } ) ) ;
336
- global . fetch = fetchStub ;
333
+ it ( 'should save preference when cloud preset' , async function ( ) {
334
+ const fetchStub = sandbox . stub ( ) . resolves ( makeResponse ( { } ) ) ;
335
+ global . fetch = fetchStub ;
337
336
338
- await atlasAiService . optIntoGenAIFeatures ( ) ;
337
+ await atlasAiService . optIntoGenAIFeatures ( ) ;
339
338
339
+ // In Data Explorer, make a POST request to cloud endpoint and save preference
340
+ if ( apiURLPreset === 'cloud' ) {
340
341
// Verify fetch was called with correct parameters
341
342
expect ( fetchStub ) . to . have . been . calledOnce ;
342
343
@@ -351,26 +352,15 @@ describe('AtlasAiService', function () {
351
352
body : new URLSearchParams ( [ [ 'value' , 'true' ] ] ) ,
352
353
}
353
354
) ;
354
-
355
- // Verify preference was saved
356
- const currentPreferences = preferences . getPreferences ( ) ;
357
- expect ( currentPreferences . optInGenAIFeatures ) . to . equal ( true ) ;
358
- } ) ;
359
- } else {
360
- it ( 'should not make any fetch request and only save preference when admin-api preset' , async function ( ) {
361
- const fetchStub = sandbox . stub ( ) . resolves ( makeResponse ( { } ) ) ;
362
- global . fetch = fetchStub ;
363
-
364
- await atlasAiService . optIntoGenAIFeatures ( ) ;
365
-
366
- // Verify no fetch was called
355
+ } else {
356
+ // In Compass, no fetch is made, only stored locally
367
357
expect ( fetchStub ) . to . not . have . been . called ;
358
+ }
368
359
369
- // Verify preference was saved
370
- const currentPreferences = preferences . getPreferences ( ) ;
371
- expect ( currentPreferences . optInGenAIFeatures ) . to . equal ( true ) ;
372
- } ) ;
373
- }
360
+ // Verify preference was saved
361
+ const currentPreferences = preferences . getPreferences ( ) ;
362
+ expect ( currentPreferences . optInGenAIFeatures ) . to . equal ( true ) ;
363
+ } ) ;
374
364
} ) ;
375
365
} ) ;
376
366
}
0 commit comments