File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed
configs/testing-library-compass Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 6262 "@testing-library/react" : " ^12.1.5" ,
6363 "@testing-library/react-hooks" : " ^7.0.2" ,
6464 "@testing-library/user-event" : " ^13.5.0" ,
65+ "mongodb-build-info" : " ^1.8.1" ,
6566 "mongodb-connection-string-url" : " ^3.0.1" ,
6667 "react" : " ^17.0.2" ,
6768 "react-redux" : " ^8.1.3" ,
Original file line number Diff line number Diff line change @@ -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- serverName : '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
You can’t perform that action at this time.
0 commit comments