setup-hugo/__tests__/os.test.ts

24 lines
558 B
TypeScript
Raw Normal View History

2024-05-02 16:38:23 +00:00
import { Platform } from '../src/os'
beforeEach(() => {
jest.resetModules()
})
describe('Platform', () => {
test('getHomeDir - should return non-empty string', () => {
const homeDir = new Platform('linux', undefined, {
HOME: '/home/prskr'
}).getHomeDir()
expect(homeDir).toBe('/home/prskr')
})
test('getHomeDir - return USERPROFILE for win32 platform', () => {
const homeDir = new Platform('win32', undefined, {
USERPROFILE: 'C:\\Users\\prskr'
}).getHomeDir()
expect(homeDir).toBe('C:\\Users\\prskr')
})
})