Skip to content

Commit 409d5fb

Browse files
committed
test(MongoBinaryDownloadUrl): move arch tests to their own block
1 parent 660e506 commit 409d5fb

File tree

1 file changed

+63
-78
lines changed

1 file changed

+63
-78
lines changed

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

Lines changed: 63 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,69 @@ describe('MongoBinaryDownloadUrl', () => {
637637
});
638638
});
639639

640+
// for arch and arch based systems (no specific extra mapping)
641+
describe('for arch', () => {
642+
it('for arch for 4.4.2', async () => {
643+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
644+
645+
const du = new MongoBinaryDownloadUrl({
646+
platform: 'linux',
647+
arch: 'x64',
648+
version: '4.4.2',
649+
os: {
650+
os: 'linux',
651+
dist: 'Arch',
652+
release: 'rolling',
653+
id_like: ['arch'],
654+
},
655+
});
656+
expect(await du.getDownloadUrl()).toBe(
657+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
658+
);
659+
expect(console.warn).toHaveBeenCalledTimes(1);
660+
});
661+
662+
it('for manjaro for 4.4.2', async () => {
663+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
664+
665+
const du = new MongoBinaryDownloadUrl({
666+
platform: 'linux',
667+
arch: 'x64',
668+
version: '4.4.2',
669+
os: {
670+
os: 'linux',
671+
dist: 'ManjaroLinux',
672+
release: '20.2',
673+
id_like: ['arch'],
674+
},
675+
});
676+
expect(await du.getDownloadUrl()).toBe(
677+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
678+
);
679+
expect(console.warn).toHaveBeenCalledTimes(1);
680+
});
681+
682+
it('for archstrike for 4.4.2', async () => {
683+
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
684+
685+
const du = new MongoBinaryDownloadUrl({
686+
platform: 'linux',
687+
arch: 'x64',
688+
version: '4.4.2',
689+
os: {
690+
os: 'linux',
691+
dist: 'ArchStrike',
692+
release: 'rolling',
693+
id_like: ['arch'],
694+
},
695+
});
696+
expect(await du.getDownloadUrl()).toBe(
697+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
698+
);
699+
expect(console.warn).toHaveBeenCalledTimes(1);
700+
});
701+
});
702+
640703
it('fallback', async () => {
641704
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
642705

@@ -677,46 +740,6 @@ describe('MongoBinaryDownloadUrl', () => {
677740
expect(console.warn).toHaveBeenCalledTimes(2);
678741
});
679742

680-
it('for manjaro', async () => {
681-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
682-
683-
const du = new MongoBinaryDownloadUrl({
684-
platform: 'linux',
685-
arch: 'x64',
686-
version: '4.4.2',
687-
os: {
688-
os: 'linux',
689-
dist: 'ManjaroLinux',
690-
release: '20.2',
691-
id_like: ['arch'],
692-
},
693-
});
694-
expect(await du.getDownloadUrl()).toBe(
695-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
696-
);
697-
expect(console.warn).toHaveBeenCalledTimes(1);
698-
});
699-
700-
it('for arch', async () => {
701-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
702-
703-
const du = new MongoBinaryDownloadUrl({
704-
platform: 'linux',
705-
arch: 'x64',
706-
version: '4.4.2',
707-
os: {
708-
os: 'linux',
709-
dist: 'Arch',
710-
release: 'rolling',
711-
id_like: ['arch'],
712-
},
713-
});
714-
expect(await du.getDownloadUrl()).toBe(
715-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
716-
);
717-
expect(console.warn).toHaveBeenCalledTimes(1);
718-
});
719-
720743
describe('for gentoo', () => {
721744
it('for gentoo 5.0.8', async () => {
722745
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
@@ -757,26 +780,6 @@ describe('MongoBinaryDownloadUrl', () => {
757780
});
758781
});
759782

760-
it('for unpopular arch', async () => {
761-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
762-
763-
const du = new MongoBinaryDownloadUrl({
764-
platform: 'linux',
765-
arch: 'x64',
766-
version: '4.4.2',
767-
os: {
768-
os: 'linux',
769-
dist: 'ArchStrike',
770-
release: 'rolling',
771-
id_like: ['arch'],
772-
},
773-
});
774-
expect(await du.getDownloadUrl()).toBe(
775-
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.2.tgz'
776-
);
777-
expect(console.warn).toHaveBeenCalledTimes(1);
778-
});
779-
780783
describe('for elementary', () => {
781784
it('should return a archive name for elementary 0.3', async () => {
782785
const du = new MongoBinaryDownloadUrl({
@@ -1723,24 +1726,6 @@ describe('MongoBinaryDownloadUrl', () => {
17231726
expect(du.getLegacyVersionString).toHaveBeenCalledTimes(1);
17241727
expect(ret).toBe('');
17251728
});
1726-
1727-
it('should give a warning about "arch"', () => {
1728-
jest.spyOn(console, 'warn').mockImplementation(() => void 0);
1729-
const du = new MongoBinaryDownloadUrl({
1730-
platform: 'linux',
1731-
arch: 'x64',
1732-
version: '3.6.3',
1733-
os: {
1734-
os: 'linux',
1735-
dist: 'archlinux',
1736-
release: '0',
1737-
codename: 'archlinux',
1738-
},
1739-
});
1740-
const ret = du.getLinuxOSVersionString(du.os as LinuxOS);
1741-
expect(console.warn).toHaveBeenCalledTimes(1);
1742-
expect(ret).toBe('ubuntu1604');
1743-
});
17441729
});
17451730

17461731
describe('translateArch()', () => {

0 commit comments

Comments
 (0)