mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(client): add linux arm64 exam download link (#67253)
This commit is contained in:
@@ -122,11 +122,25 @@ describe('handleDownloadLink', () => {
|
||||
expect(result).toBe('url_x64.exe');
|
||||
});
|
||||
|
||||
test('normalizes arm64 to arm', () => {
|
||||
const links = ['url_fake.dmg', 'url_arm.dmg'];
|
||||
test('normalizes aarch64 to arm64', () => {
|
||||
const links = ['url_fake.dmg', 'url_aarch64.dmg'];
|
||||
const osState: UserOSState = { os: 'MAC', architecture: 'arm64' };
|
||||
const result = handleDownloadLink(osState, links);
|
||||
expect(result).toBe('url_arm.dmg');
|
||||
expect(result).toBe('url_aarch64.dmg');
|
||||
});
|
||||
|
||||
test('normalizes arm64 to arm64', () => {
|
||||
const links = ['url_fake.dmg', 'url_arm64.dmg'];
|
||||
const osState: UserOSState = { os: 'MAC', architecture: 'arm64' };
|
||||
const result = handleDownloadLink(osState, links);
|
||||
expect(result).toBe('url_arm64.dmg');
|
||||
});
|
||||
|
||||
test('does not normalize arm64 to arm', () => {
|
||||
const links = ['url_arm.dmg', 'url_arm64.dmg'];
|
||||
const osState: UserOSState = { os: 'MAC', architecture: 'arm64' };
|
||||
const result = handleDownloadLink(osState, links);
|
||||
expect(result).toBe('url_arm64.dmg');
|
||||
});
|
||||
|
||||
test('normalizes i386 to x86', () => {
|
||||
|
||||
@@ -186,14 +186,15 @@ interface ShowExamDownloadProps {
|
||||
|
||||
function normalizeArch(name: string): string {
|
||||
const archMatch = name.match(
|
||||
/(aarch64|arm|arm64|amd64|x86_64|x64|x86|i386|i686)/i
|
||||
/(aarch64|arm64|arm|amd64|x86_64|x64|x86|i386|i686)/i
|
||||
);
|
||||
|
||||
const token = archMatch?.[0];
|
||||
|
||||
if (!token) return '';
|
||||
const t = token.toLowerCase();
|
||||
if (/aarch64|arm64|arm/i.test(t)) return 'arm';
|
||||
if (/aarch64|arm64/i.test(t)) return 'arm64';
|
||||
if (/arm/i.test(t)) return 'arm';
|
||||
if (/x86_64|x64|amd64/i.test(t)) return 'x64';
|
||||
if (/x86|i386|i686/i.test(t)) return 'x86';
|
||||
return t;
|
||||
@@ -441,10 +442,12 @@ function getRecommendedOs({
|
||||
} as const;
|
||||
const archToHuman: Record<string, string> = {
|
||||
x64: '64-bit',
|
||||
aarch64: 'ARM',
|
||||
aarch64: 'ARM64',
|
||||
arm64: 'ARM64',
|
||||
amd64: '64-bit',
|
||||
i386: '32-bit',
|
||||
x86: '32-bit'
|
||||
x86: '32-bit',
|
||||
arm: 'ARM'
|
||||
};
|
||||
|
||||
const os = Object.entries(osToExt).find(([_, exts]) => exts.includes(ext));
|
||||
|
||||
Reference in New Issue
Block a user