setup-hugo/__tests__/hugo.test.ts
Peter Kurfer 034dd15f69
All checks were successful
Check Transpiled JavaScript / Check dist/ (push) Successful in 31s
Continuous Integration / GitHub Actions Test (push) Successful in 9s
Continuous Integration / TypeScript Tests (push) Successful in 47s
feat: use cache
2024-05-03 16:17:32 +02:00

32 lines
821 B
TypeScript

import { HugoInstaller } from '../src/hugo'
import { OctokitReleaseLookup } from '../src/asset-lookup'
import * as fs from 'node:fs'
import path from 'path'
import * as os from 'node:os'
import { Platform } from '../src/os'
let tmpDir = ''
beforeEach(() => {
jest.resetModules()
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-hugo-'))
})
afterEach(() => {
fs.rmSync(tmpDir, { recursive: true })
})
describe('Install Hugo', () => {
test('Download latest Hugo', async () => {
const releaseLookup = new OctokitReleaseLookup()
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
const hugo = new HugoInstaller(releaseLookup, platformMock)
expect(
async () =>
await hugo.install({
version: 'latest'
})
).not.toThrow()
}, 30_000)
})