63 lines
2.1 KiB
TypeScript
63 lines
2.1 KiB
TypeScript
import * as util from '../src/util'
|
|
|
|
describe('getPlatformExtension', () => {
|
|
it('should return "zip" for Windows', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'win32' })
|
|
expect(util.getPlatformExtension()).toBe('zip')
|
|
})
|
|
|
|
it('should return "tgz" for non-Windows platforms', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'linux' })
|
|
expect(util.getPlatformExtension()).toBe('tgz')
|
|
|
|
Object.defineProperty(process, 'platform', { value: 'darwin' })
|
|
expect(util.getPlatformExtension()).toBe('tgz')
|
|
})
|
|
})
|
|
|
|
describe('getConanArchitecture', () => {
|
|
it('should return "x86_64" for x64 architecture', () => {
|
|
Object.defineProperty(process, 'arch', { value: 'x64' })
|
|
expect(util.getConanArchitecture()).toBe('x86_64')
|
|
})
|
|
|
|
it('should return "i686" for ia32 architecture', () => {
|
|
Object.defineProperty(process, 'arch', { value: 'ia32' })
|
|
expect(util.getConanArchitecture()).toBe('i686')
|
|
})
|
|
|
|
it('should return the same architecture string for other architectures', () => {
|
|
Object.defineProperty(process, 'arch', { value: 'arm64' })
|
|
expect(util.getConanArchitecture()).toBe('arm64')
|
|
})
|
|
})
|
|
|
|
describe('getConanPlatform', () => {
|
|
it('should return "windows" for Windows', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'win32' })
|
|
expect(util.getConanPlatform()).toBe('windows')
|
|
})
|
|
|
|
it('should return "macos" for macOS', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'darwin' })
|
|
expect(util.getConanPlatform()).toBe('macos')
|
|
})
|
|
|
|
it('should return "linux" for non-Windows and non-macOS platforms', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'linux' })
|
|
expect(util.getConanPlatform()).toBe('linux')
|
|
})
|
|
})
|
|
|
|
describe('getConanBinPath', () => {
|
|
it('should return an empty string for Windows', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'win32' })
|
|
expect(util.getConanBinPath()).toBe('')
|
|
})
|
|
|
|
it('should return "/bin" for non-Windows platforms', () => {
|
|
Object.defineProperty(process, 'platform', { value: 'linux' })
|
|
expect(util.getConanBinPath()).toBe('/bin')
|
|
})
|
|
})
|