2019-09-21 03:41:21 +02:00
|
|
|
import getURL from '../src/get-url';
|
|
|
|
|
|
|
|
describe('getURL()', () => {
|
2020-10-12 08:26:57 +02:00
|
|
|
test('get a URL to an asset for each platform', () => {
|
2020-06-21 22:40:06 +02:00
|
|
|
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
2019-09-21 03:41:21 +02:00
|
|
|
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
|
|
|
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
|
|
|
|
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
2021-05-27 06:03:38 +02:00
|
|
|
const urlMacOSExtended = `${baseURL}/hugo_extended_0.58.2_macOS-64bit.tar.gz`;
|
2019-09-21 03:41:21 +02:00
|
|
|
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
2021-05-27 06:03:38 +02:00
|
|
|
expect(getURL('Linux', '64bit', 'false', '0.58.2')).toBe(urlLinux);
|
|
|
|
expect(getURL('Linux', '64bit', 'true', '0.58.2')).not.toBe(urlLinux);
|
|
|
|
expect(getURL('MyOS', '64bit', 'false', '0.58.2')).not.toBe(urlLinux);
|
|
|
|
expect(getURL('Linux', '64bit', 'false', '0.58.1')).not.toBe(urlLinux);
|
|
|
|
expect(getURL('Linux', '64bit', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
|
|
|
expect(getURL('macOS', '64bit', 'false', '0.58.2')).toBe(urlMacOS);
|
|
|
|
expect(getURL('macOS', '64bit', 'true', '0.58.2')).toBe(urlMacOSExtended);
|
|
|
|
expect(getURL('Windows', '64bit', 'false', '0.58.2')).toBe(urlWindows);
|
2019-09-21 03:41:21 +02:00
|
|
|
});
|
|
|
|
});
|