Files
setup-conan/__tests__/util.test.ts
Lucas Petrino 42fb744b4f
Some checks failed
Continuous Integration / GitHub Actions Test (push) Successful in 23s
CodeQL / Analyze (TypeScript) (push) Failing after 5m27s
Check Transpiled JavaScript / Check dist/ (push) Has been cancelled
Continuous Integration / TypeScript Tests (push) Has been cancelled
Lint Codebase / Lint Codebase (push) Has been cancelled
Initial Commit
2024-11-05 23:08:13 +13:00

51 lines
1.7 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')
})
})