Skip to content

Commit 0be5d02

Browse files
committed
test(MongoBinaryDownloadUrl): add tests for "translatePlatform"
1 parent c1d627b commit 0be5d02

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

packages/mongodb-memory-server-core/src/util/__tests__/MongoBinaryDownloadUrl.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,4 +1335,56 @@ describe('MongoBinaryDownloadUrl', () => {
13351335
}
13361336
});
13371337
});
1338+
1339+
describe('translatePlatform()', () => {
1340+
it('should translate "darwin" to "osx"', () => {
1341+
const du = new MongoBinaryDownloadUrl({
1342+
platform: 'darwin',
1343+
arch: 'x64',
1344+
version: '5.0.8',
1345+
os: {
1346+
os: 'darwin',
1347+
},
1348+
});
1349+
expect(du.translatePlatform('darwin')).toBe('osx');
1350+
});
1351+
1352+
it('should translate "linux" to "linux"', () => {
1353+
const du = new MongoBinaryDownloadUrl({
1354+
platform: 'linux',
1355+
arch: 'x64',
1356+
version: '5.0.8',
1357+
os: {
1358+
os: 'linux',
1359+
dist: 'ubuntu',
1360+
release: '20.04',
1361+
},
1362+
});
1363+
expect(du.translatePlatform('linux')).toBe('linux');
1364+
});
1365+
1366+
it('should translate "win32" to "win32" for below 4.3.0', () => {
1367+
const du = new MongoBinaryDownloadUrl({
1368+
platform: 'win32',
1369+
arch: 'x64',
1370+
version: '4.2.0',
1371+
os: {
1372+
os: 'win32',
1373+
},
1374+
});
1375+
expect(du.translatePlatform('win32')).toBe('win32');
1376+
});
1377+
1378+
it('should translate "win32" to "windows" for above & equal to 4.3.0', () => {
1379+
const du = new MongoBinaryDownloadUrl({
1380+
platform: 'win32',
1381+
arch: 'x64',
1382+
version: '4.3.0',
1383+
os: {
1384+
os: 'win32',
1385+
},
1386+
});
1387+
expect(du.translatePlatform('win32')).toBe('windows');
1388+
});
1389+
});
13381390
});

0 commit comments

Comments
 (0)