Skip to content

Commit 1bacbd1

Browse files
committed
test(MongoBinaryDownloadUrl): add some more tests for ubuntu2204
1 parent b9307bd commit 1bacbd1

File tree

1 file changed

+71
-1
lines changed

1 file changed

+71
-1
lines changed

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

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('MongoBinaryDownloadUrl', () => {
9696

9797
describe('for linux', () => {
9898
describe('for ubuntu', () => {
99-
it('for ubuntu x64', async () => {
99+
it('for ubuntu 14.04 for 3.6', async () => {
100100
const du = new MongoBinaryDownloadUrl({
101101
platform: 'linux',
102102
arch: 'x64',
@@ -112,6 +112,54 @@ describe('MongoBinaryDownloadUrl', () => {
112112
);
113113
});
114114

115+
it('for ubuntu 20.04 for 4.0', async () => {
116+
const du = new MongoBinaryDownloadUrl({
117+
platform: 'linux',
118+
arch: 'x64',
119+
version: '4.0.0',
120+
os: {
121+
os: 'linux',
122+
dist: 'ubuntu',
123+
release: '2004',
124+
},
125+
});
126+
expect(await du.getDownloadUrl()).toBe(
127+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.0.tgz'
128+
);
129+
});
130+
131+
it('for ubuntu 22.04 for 4.0', async () => {
132+
const du = new MongoBinaryDownloadUrl({
133+
platform: 'linux',
134+
arch: 'x64',
135+
version: '4.0.0',
136+
os: {
137+
os: 'linux',
138+
dist: 'ubuntu',
139+
release: '2204',
140+
},
141+
});
142+
expect(await du.getDownloadUrl()).toBe(
143+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.0.tgz'
144+
);
145+
});
146+
147+
it('for ubuntu 22.04 for 4.4', async () => {
148+
const du = new MongoBinaryDownloadUrl({
149+
platform: 'linux',
150+
arch: 'x64',
151+
version: '4.4.0',
152+
os: {
153+
os: 'linux',
154+
dist: 'ubuntu',
155+
release: '2204',
156+
},
157+
});
158+
expect(await du.getDownloadUrl()).toBe(
159+
'https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.0.tgz'
160+
);
161+
});
162+
115163
it('for ubuntu 20.04 for 5.0', async () => {
116164
const du = new MongoBinaryDownloadUrl({
117165
platform: 'linux',
@@ -1151,6 +1199,28 @@ describe('MongoBinaryDownloadUrl', () => {
11511199
).toBe('ubuntu2004');
11521200
});
11531201

1202+
it('should return a archive name for Ubuntu 22.04 using 1804 4.0', () => {
1203+
downloadUrl.version = '4.0.0';
1204+
expect(
1205+
downloadUrl.getUbuntuVersionString({
1206+
os: 'linux',
1207+
dist: 'Ubuntu Linux',
1208+
release: '22.04',
1209+
})
1210+
).toBe('ubuntu1804');
1211+
});
1212+
1213+
it('should return a archive name for Ubuntu 22.04 using 2004 4.4', () => {
1214+
downloadUrl.version = '4.4.0';
1215+
expect(
1216+
downloadUrl.getUbuntuVersionString({
1217+
os: 'linux',
1218+
dist: 'Ubuntu Linux',
1219+
release: '22.04',
1220+
})
1221+
).toBe('ubuntu2004');
1222+
});
1223+
11541224
it('should return default version with warning when using ID_LIKE but not being ubuntu', () => {
11551225
// Test for https://github.com/nodkz/mongodb-memory-server/issues/616
11561226
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementationOnce(() => void 0);

0 commit comments

Comments
 (0)