Skip to content

Commit a4a95ca

Browse files
committed
test: add tests
1 parent 5ee3601 commit a4a95ca

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

packages/compass-connections/src/utils/connection-supports.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ const mockConnections: ConnectionInfo[] = [
9292
instanceSize: 'M10',
9393
clusterType: 'SHARDED',
9494
clusterUniqueId: 'clusterUniqueId',
95+
geoSharding: {
96+
selfManagedSharding: false,
97+
},
9598
},
9699
},
97100
{
@@ -111,6 +114,26 @@ const mockConnections: ConnectionInfo[] = [
111114
clusterUniqueId: 'clusterUniqueId',
112115
},
113116
},
117+
{
118+
id: 'dedicated-geo-sharded-self-managed',
119+
connectionOptions: {
120+
connectionString: 'mongodb://foo',
121+
},
122+
atlasMetadata: {
123+
orgId: 'orgId',
124+
projectId: 'projectId',
125+
clusterName: 'clusterName',
126+
regionalBaseUrl: 'https://example.com',
127+
metricsId: 'metricsId',
128+
metricsType: 'cluster',
129+
instanceSize: 'M30',
130+
clusterType: 'GEOSHARDED',
131+
clusterUniqueId: 'clusterUniqueId',
132+
geoSharding: {
133+
selfManagedSharding: true,
134+
},
135+
},
136+
},
114137
];
115138

116139
function connectionInfoById(connectionId: string): ConnectionInfo {
@@ -195,5 +218,14 @@ describe('connectionSupports', function () {
195218
)
196219
).to.be.true;
197220
});
221+
222+
it('should return false if the cluster type is geosharded but self managed', function () {
223+
expect(
224+
connectionSupports(
225+
connectionInfoById('dedicated-geo-sharded-self-managed'),
226+
'globalWrites'
227+
)
228+
).to.be.false;
229+
});
198230
});
199231
});

packages/compass-web/src/connection-storage.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ describe('buildConnectionInfoFromClusterDescription', function () {
6868
dataProcessingRegion: {
6969
regionalUrl: 'https://example.com',
7070
},
71+
geoSharding: {
72+
selfManagedSharding: true,
73+
},
7174
replicationSpecList: [
7275
{
7376
regionConfigs: [
@@ -162,6 +165,10 @@ describe('buildConnectionInfoFromClusterDescription', function () {
162165
instanceSize: expectedInstanceSize,
163166
regionalBaseUrl: 'https://example.com',
164167
clusterType: clusterDescription.clusterType,
168+
geoSharding: {
169+
selfManagedSharding:
170+
clusterDescription.geoSharding?.selfManagedSharding,
171+
},
165172
});
166173
});
167174
}

0 commit comments

Comments
 (0)