UPDATE getUrl with actual mappings

This commit is contained in:
RecuencoJones
2020-02-12 20:27:48 +01:00
parent a16e524d99
commit 40e5bed491
3 changed files with 9 additions and 9 deletions

View File

@@ -60,7 +60,7 @@ describe('common', () => {
const url = common.getUrl({
default: 'http://url.tar.gz',
windows: 'http://url.exe.zip'
}, { platform: 'windows' });
}, { platform: 'win32' });
expect(url).toEqual('http://url.exe.zip');
});
@@ -82,7 +82,7 @@ describe('common', () => {
default: 'http://url_darwin.tar.gz',
386: 'http://url_darwin_i386.tar.gz'
}
}, { platform: 'darwin', arch: '386' });
}, { platform: 'darwin', arch: 'ia32' });
expect(url).toEqual('http://url_darwin_i386.tar.gz');
});

View File

@@ -15,7 +15,7 @@
"dependencies": {
"mkdirp": "^0.5.1",
"request": "^2.81.0",
"tar": "^2.2.1"
"tar": "^2.2.2"
},
"repository": {
"type": "git",
@@ -23,8 +23,8 @@
},
"homepage": "https://github.com/sanathkr/go-npm",
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"jest": "^24.5.0"
}

View File

@@ -78,8 +78,8 @@ function getUrl(url, process) {
let _url;
if (url[process.platform]) {
_url = url[process.platform];
if (url[PLATFORM_MAPPING[process.platform]]) {
_url = url[PLATFORM_MAPPING[process.platform]];
} else {
_url = url.default;
}
@@ -88,8 +88,8 @@ function getUrl(url, process) {
return _url;
}
if (_url[process.arch]) {
_url = _url[process.arch]
if (_url[ARCH_MAPPING[process.arch]]) {
_url = _url[ARCH_MAPPING[process.arch]]
} else {
_url = _url.default;
}