@@ -34,6 +34,7 @@ import type {
3434 DataService ,
3535 InstanceDetails ,
3636} from 'mongodb-data-service' ;
37+ import { identifyServerName } from 'mongodb-build-info' ;
3738import Sinon from 'sinon' ;
3839import React from 'react' ;
3940import type {
@@ -175,8 +176,22 @@ export class MockDataService
175176 disconnect ( ) : Promise < void > {
176177 return Promise . resolve ( ) ;
177178 }
178- instance ( ) : Promise < InstanceDetails > {
179- return Promise . resolve ( {
179+ async instance ( ) : Promise < InstanceDetails > {
180+ const { connectionString } = this . connectionOptions ;
181+ const serverName = await identifyServerName ( {
182+ connectionString,
183+ adminCommand : ( ) =>
184+ Promise . reject (
185+ new Error (
186+ 'MockDataService adminCommand: this is a mocked environment; no server commands available.'
187+ )
188+ ) ,
189+ } ) ;
190+ const genuineMongoDB = {
191+ serverName,
192+ isGenuine : serverName === 'mongodb' || serverName === 'unknown' ,
193+ } ;
194+ return {
180195 auth : {
181196 user : null ,
182197 roles : [ ] ,
@@ -188,10 +203,7 @@ export class MockDataService
188203 version : '100.0.0' ,
189204 } ,
190205 host : { } ,
191- genuineMongoDB : {
192- isGenuine : true ,
193- dbType : 'mongodb' ,
194- } ,
206+ genuineMongoDB,
195207 dataLake : {
196208 isDataLake : false ,
197209 version : null ,
@@ -200,7 +212,7 @@ export class MockDataService
200212 isAtlas : false ,
201213 isLocalAtlas : false ,
202214 csfleMode : 'unavailable' ,
203- } ) ;
215+ } ;
204216 }
205217}
206218
@@ -410,6 +422,13 @@ function unwrapContextMenuContainer(result: RenderResult) {
410422 firstChild instanceof HTMLElement &&
411423 firstChild . getAttribute ( 'data-testid' ) === 'context-menu-children-container'
412424 ) {
425+ if (
426+ firstChild . firstChild instanceof HTMLElement &&
427+ firstChild . firstChild . getAttribute ( 'data-testid' ) ===
428+ 'copy-paste-context-menu-container'
429+ ) {
430+ return { container : firstChild . firstChild , ...rest } ;
431+ }
413432 return { container : firstChild , ...rest } ;
414433 } else {
415434 return { container, ...rest } ;
0 commit comments