2021-05-27 06:03:38 +02:00
|
|
|
import getArch from '../src/get-arch';
|
|
|
|
|
|
|
|
|
|
describe('getArch', () => {
|
2022-10-06 06:47:41 -05:00
|
|
|
test('processor architecture < 0.102.0', () => {
|
|
|
|
|
expect(getArch('x64', 'linux', '0.101.0')).toBe('64bit');
|
|
|
|
|
expect(getArch('x64', 'macOS', '0.101.0')).toBe('64bit');
|
|
|
|
|
expect(getArch('x64', 'windows', '0.101.0')).toBe('64bit');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm', 'linux', '0.101.0')).toBe('ARM');
|
|
|
|
|
expect(getArch('arm', 'macOS', '0.101.0')).toBe('ARM');
|
|
|
|
|
expect(getArch('arm', 'windows', '0.101.0')).toBe('ARM');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm64', 'linux', '0.101.0')).toBe('ARM64');
|
|
|
|
|
expect(getArch('arm64', 'macOS', '0.101.0')).toBe('ARM64');
|
|
|
|
|
expect(getArch('arm64', 'windows', '0.101.0')).toBe('ARM64');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('processor architecture === 0.102.z', () => {
|
|
|
|
|
expect(getArch('x64', 'linux', '0.102.0')).toBe('64bit');
|
|
|
|
|
expect(getArch('x64', 'macOS', '0.102.0')).toBe('universal');
|
|
|
|
|
expect(getArch('x64', 'windows', '0.102.0')).toBe('64bit');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm', 'macOS', '0.102.0')).toBe('universal');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm64', 'linux', '0.102.0')).toBe('ARM64');
|
|
|
|
|
expect(getArch('arm64', 'macOS', '0.102.0')).toBe('universal');
|
|
|
|
|
expect(getArch('arm64', 'windows', '0.102.0')).toBe('ARM64');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('processor architecture === 0.103.z', () => {
|
|
|
|
|
expect(getArch('x64', 'linux', '0.103.0')).toBe('amd64');
|
|
|
|
|
expect(getArch('x64', 'darwin', '0.103.0')).toBe('universal');
|
|
|
|
|
expect(getArch('x64', 'windows', '0.103.0')).toBe('amd64');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm', 'darwin', '0.103.0')).toBe('universal');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm64', 'linux', '0.103.0')).toBe('arm64');
|
|
|
|
|
expect(getArch('arm64', 'darwin', '0.103.0')).toBe('universal');
|
|
|
|
|
expect(getArch('arm64', 'windows', '0.103.0')).toBe('arm64');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('processor architecture > 0.103.0', () => {
|
|
|
|
|
expect(getArch('x64', 'linux', '0.104.0')).toBe('amd64');
|
|
|
|
|
expect(getArch('x64', 'darwin', '0.104.0')).toBe('universal');
|
|
|
|
|
expect(getArch('x64', 'windows', '0.104.0')).toBe('amd64');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm', 'darwin', '0.104.0')).toBe('universal');
|
|
|
|
|
|
|
|
|
|
expect(getArch('arm64', 'linux', '0.104.0')).toBe('arm64');
|
|
|
|
|
expect(getArch('arm64', 'darwin', '0.104.0')).toBe('universal');
|
|
|
|
|
expect(getArch('arm64', 'windows', '0.104.0')).toBe('arm64');
|
2021-05-27 06:03:38 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('exception', () => {
|
|
|
|
|
expect(() => {
|
2022-10-06 06:47:41 -05:00
|
|
|
getArch('mips', 'linux', '0.101.0');
|
2022-10-06 13:13:28 +00:00
|
|
|
}).toThrow('mips is not supported');
|
2022-10-06 06:47:41 -05:00
|
|
|
|
|
|
|
|
expect(() => {
|
|
|
|
|
getArch('arm', 'linux', '0.102.0')
|
2022-10-06 13:13:28 +00:00
|
|
|
}).toThrow('arm is not supported');
|
2021-05-27 06:03:38 +02:00
|
|
|
});
|
|
|
|
|
});
|