2019-09-21 10:41:21 +09:00
|
|
|
import getOS from '../src/get-os';
|
|
|
|
|
|
|
|
|
|
describe('getOS', () => {
|
2020-10-12 15:26:57 +09:00
|
|
|
test('os type', () => {
|
2022-10-06 06:47:41 -05:00
|
|
|
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');
|
2019-09-21 10:41:21 +09:00
|
|
|
});
|
|
|
|
|
|
2020-10-12 15:26:57 +09:00
|
|
|
test('exception', () => {
|
2019-09-21 10:41:21 +09:00
|
|
|
expect(() => {
|
2022-10-06 06:47:41 -05:00
|
|
|
getOS('centos', '0.101.0');
|
2022-10-06 13:13:28 +00:00
|
|
|
}).toThrow('centos is not supported');
|
2019-09-21 10:41:21 +09:00
|
|
|
});
|
|
|
|
|
});
|