Skip to content

Commit

Permalink
test(MongoBinaryDownloadUrl): add some more tests for ubuntu2204
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Dec 11, 2022
1 parent b9307bd commit 1bacbd1
Showing 1 changed file with 71 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('MongoBinaryDownloadUrl', () => {

describe('for linux', () => {
describe('for ubuntu', () => {
it('for ubuntu x64', async () => {
it('for ubuntu 14.04 for 3.6', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
Expand All @@ -112,6 +112,54 @@ describe('MongoBinaryDownloadUrl', () => {
);
});

it('for ubuntu 20.04 for 4.0', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.0.0',
os: {
os: 'linux',
dist: 'ubuntu',
release: '2004',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.0.tgz'
);
});

it('for ubuntu 22.04 for 4.0', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.0.0',
os: {
os: 'linux',
dist: 'ubuntu',
release: '2204',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.0.tgz'
);
});

it('for ubuntu 22.04 for 4.4', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
arch: 'x64',
version: '4.4.0',
os: {
os: 'linux',
dist: 'ubuntu',
release: '2204',
},
});
expect(await du.getDownloadUrl()).toBe(
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.0.tgz'
);
});

it('for ubuntu 20.04 for 5.0', async () => {
const du = new MongoBinaryDownloadUrl({
platform: 'linux',
Expand Down Expand Up @@ -1151,6 +1199,28 @@ describe('MongoBinaryDownloadUrl', () => {
).toBe('ubuntu2004');
});

it('should return a archive name for Ubuntu 22.04 using 1804 4.0', () => {
downloadUrl.version = '4.0.0';
expect(
downloadUrl.getUbuntuVersionString({
os: 'linux',
dist: 'Ubuntu Linux',
release: '22.04',
})
).toBe('ubuntu1804');
});

it('should return a archive name for Ubuntu 22.04 using 2004 4.4', () => {
downloadUrl.version = '4.4.0';
expect(
downloadUrl.getUbuntuVersionString({
os: 'linux',
dist: 'Ubuntu Linux',
release: '22.04',
})
).toBe('ubuntu2004');
});

it('should return default version with warning when using ID_LIKE but not being ubuntu', () => {
// Test for https://github.com/nodkz/mongodb-memory-server/issues/616
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementationOnce(() => void 0);
Expand Down

0 comments on commit 1bacbd1

Please sign in to comment.