Skip to content

Commit ecaec51

Browse files
committed
test(MongoBinaryDownloadUrl): add tests for "translateArch"
1 parent 29763b9 commit ecaec51

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,4 +647,34 @@ describe('MongoBinaryDownloadUrl', () => {
647647
expect(ret).toBe('');
648648
});
649649
});
650+
651+
describe('translateArch()', () => {
652+
it('should translate "ia32" and linux to "i686"', () => {
653+
expect(MongoBinaryDownloadUrl.translateArch('ia32', 'linux')).toBe('i686');
654+
});
655+
656+
it('should translate "ia32" and win32 to "i386"', () => {
657+
expect(MongoBinaryDownloadUrl.translateArch('ia32', 'win32')).toBe('i386');
658+
});
659+
660+
it('should throw an error for "ia32" and unsupported platform', () => {
661+
try {
662+
MongoBinaryDownloadUrl.translateArch('ia32', 'darwin');
663+
fail('Expected "translateArch" to fail');
664+
} catch (err) {
665+
expect(err.message).toBe(
666+
'Unsupported Architecture-Platform combination: arch: "ia32", platform: "darwin"'
667+
);
668+
}
669+
});
670+
671+
it('should throw an error for an unsupported architecture', () => {
672+
try {
673+
MongoBinaryDownloadUrl.translateArch('risc', 'linux');
674+
fail('Expected "translateArch" to fail');
675+
} catch (err) {
676+
expect(err.message).toBe('Unsupported Architecture: arch: "risc"');
677+
}
678+
});
679+
});
650680
});

0 commit comments

Comments
 (0)