@@ -234,19 +234,67 @@ describe('CompassAssistantProvider', function () {
234
234
expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
235
235
} ) ;
236
236
237
- it ( 'does not render assistant drawer when AI assistant is disabled' , function ( ) {
238
- render ( < TestComponent chat = { createMockChat ( { messages : [ ] } ) } /> , {
239
- preferences : {
240
- enableAIAssistant : false ,
241
- enableGenAIFeatures : true ,
242
- enableGenAIFeaturesAtlasOrg : true ,
243
- cloudFeatureRolloutAccess : { GEN_AI_COMPASS : true } ,
244
- } ,
237
+ describe ( 'disabling the Assistant' , function ( ) {
238
+ it ( 'does not render assistant drawer when AI assistant is disabled' , function ( ) {
239
+ render ( < TestComponent chat = { createMockChat ( { messages : [ ] } ) } /> , {
240
+ preferences : {
241
+ enableAIAssistant : false ,
242
+ enableGenAIFeatures : true ,
243
+ enableGenAIFeaturesAtlasOrg : true ,
244
+ cloudFeatureRolloutAccess : { GEN_AI_COMPASS : true } ,
245
+ } ,
246
+ } ) ;
247
+
248
+ expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
249
+ // The drawer toolbar button should not exist when disabled
250
+ expect ( screen . queryByLabelText ( 'MongoDB Assistant' ) ) . to . not . exist ;
245
251
} ) ;
246
252
247
- expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
248
- // The drawer toolbar button should not exist when disabled
249
- expect ( screen . queryByLabelText ( 'MongoDB Assistant' ) ) . to . not . exist ;
253
+ it ( 'does not render assistant drawer when AI features are disabled via isAIFeatureEnabled' , function ( ) {
254
+ render ( < TestComponent chat = { createMockChat ( { messages : [ ] } ) } /> , {
255
+ preferences : {
256
+ enableAIAssistant : true ,
257
+ // These control isAIFeatureEnabled
258
+ enableGenAIFeatures : false ,
259
+ enableGenAIFeaturesAtlasOrg : true ,
260
+ cloudFeatureRolloutAccess : { GEN_AI_COMPASS : true } ,
261
+ } ,
262
+ } ) ;
263
+
264
+ expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
265
+ // The drawer toolbar button should not exist when AI features are disabled
266
+ expect ( screen . queryByLabelText ( 'MongoDB Assistant' ) ) . to . not . exist ;
267
+ } ) ;
268
+
269
+ it ( 'does not render assistant drawer when Atlas org AI features are disabled' , function ( ) {
270
+ render ( < TestComponent chat = { createMockChat ( { messages : [ ] } ) } /> , {
271
+ preferences : {
272
+ enableAIAssistant : true ,
273
+ enableGenAIFeatures : true ,
274
+ enableGenAIFeaturesAtlasOrg : false ,
275
+ cloudFeatureRolloutAccess : { GEN_AI_COMPASS : true } ,
276
+ } ,
277
+ } ) ;
278
+
279
+ expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
280
+ // The drawer toolbar button should not exist when Atlas org AI features are disabled
281
+ expect ( screen . queryByLabelText ( 'MongoDB Assistant' ) ) . to . not . exist ;
282
+ } ) ;
283
+
284
+ it ( 'does not render assistant drawer when cloud feature rollout access is disabled' , function ( ) {
285
+ render ( < TestComponent chat = { createMockChat ( { messages : [ ] } ) } /> , {
286
+ preferences : {
287
+ enableAIAssistant : true ,
288
+ enableGenAIFeatures : true ,
289
+ enableGenAIFeaturesAtlasOrg : true ,
290
+ cloudFeatureRolloutAccess : { GEN_AI_COMPASS : false } ,
291
+ } ,
292
+ } ) ;
293
+
294
+ expect ( screen . getByTestId ( 'provider-children' ) ) . to . exist ;
295
+ // The drawer toolbar button should not exist when cloud feature rollout access is disabled
296
+ expect ( screen . queryByLabelText ( 'MongoDB Assistant' ) ) . to . not . exist ;
297
+ } ) ;
250
298
} ) ;
251
299
252
300
it ( 'renders the assistant drawer as the first drawer item when AI assistant is enabled' , function ( ) {
0 commit comments