mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 01:55:29 +08:00

Prior to this change, the URL building for versions of hugo was deterministic as the URLs for the packages were set to a project-specific standard. That URL creation began to fail for macOS in [0.102.0] and for Windows in [0.103.0]. It does not fail for Linux because the hugo releases for Linux continue to include the old package naming as an alias. This change: - Updates the `get-os` function to take the hugo version as additional input, altering the return value based on the version. - Updates the `get-arch` function to take the operating system name and hugo version as additional input, altering the return value based on both. Including the OS name is required for handling macOS. - Fixes #608 - Fixes #605 [0.102.0]: https://github.com/gohugoio/hugo/releases/tag/v0.102.0 [0.103.0]: https://github.com/gohugoio/hugo/releases/tag/v0.103.0
28 lines
888 B
TypeScript
28 lines
888 B
TypeScript
import getOS from '../src/get-os';
|
|
|
|
describe('getOS', () => {
|
|
test('os type', () => {
|
|
expect(getOS('linux', '0.101.0')).toBe('Linux');
|
|
expect(getOS('darwin', '0.101.0')).toBe('macOS');
|
|
expect(getOS('win32', '0.101.0')).toBe('Windows');
|
|
|
|
expect(getOS('linux', '0.102.0')).toBe('Linux');
|
|
expect(getOS('darwin', '0.102.0')).toBe('darwin');
|
|
expect(getOS('win32', '0.102.0')).toBe('Windows');
|
|
|
|
expect(getOS('linux', '0.103.0')).toBe('linux');
|
|
expect(getOS('darwin', '0.103.0')).toBe('darwin');
|
|
expect(getOS('win32', '0.103.0')).toBe('windows');
|
|
|
|
expect(getOS('linux', '0.104.0')).toBe('linux');
|
|
expect(getOS('darwin', '0.104.0')).toBe('darwin');
|
|
expect(getOS('win32', '0.104.0')).toBe('windows');
|
|
});
|
|
|
|
test('exception', () => {
|
|
expect(() => {
|
|
getOS('centos', '0.101.0');
|
|
}).toThrowError('centos is not supported');
|
|
});
|
|
});
|