Skip to content

Commit 826e6db

Browse files
committed
Add test
1 parent fb00c46 commit 826e6db

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

packages/mongodb-build-info/test/fixtures.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ export const CMD_LINE_OPTS = {
6969
ok: 1,
7070
};
7171

72+
export const ATLAS_URIS = [
73+
'mongodb+srv://x:[email protected]/',
74+
'mongodb+srv://x:[email protected]/',
75+
'mongodb+srv://x:[email protected]/',
76+
'mongodb://x:y@atlas-stream-64ba1372b2a9f1545031f34d-gkumd.virginia-usa.a.query.mongodb.net/',
77+
];
78+
7279
export const COSMOS_DB_URI = [
7380
'mongodb://x:[email protected]:19555/?ssl=true&retrywrites=false&maxIdleTimeMS=120000&appName=@compass-serverless@',
7481
'mongodb://x:[email protected]:19555/?ssl=true&retrywrites=false&maxIdleTimeMS=120000&appName=@compass@',

packages/mongodb-build-info/test/index.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,16 @@ describe('mongodb-build-info', function () {
436436
return Promise.reject(new Error('Should not be called'));
437437
}
438438

439+
it('reports MongoDB (when Atlas)', async function () {
440+
for (const connectionString of fixtures.ATLAS_URIS) {
441+
const result = await identifyServerName({
442+
connectionString,
443+
adminCommand: fail,
444+
});
445+
expect(result).to.equal('mongodb');
446+
}
447+
});
448+
439449
it('reports CosmosDB', async function () {
440450
for (const connectionString of fixtures.COSMOS_DB_URI) {
441451
const result = await identifyServerName({

0 commit comments

Comments
 (0)