setup-hugo/__tests__/asset-lookup.test.ts
Peter Kurfer 2fc1d51eb6
Some checks failed
Continuous Integration / TypeScript Tests (push) Failing after 38s
Continuous Integration / GitHub Actions Test (push) Failing after 7s
Check Transpiled JavaScript / Check dist/ (push) Successful in 1m29s
feat: initial version
2024-05-02 18:38:23 +02:00

39 lines
1.2 KiB
TypeScript

import { OctokitReleaseLookup } from '../src/asset-lookup'
import { Platform } from '../src/os'
import { HugoReleaseTransformer } from '../src/hugo'
import { DartSass, Hugo } from '../src/constants'
import { DartSassReleaseTransformer } from '../src/dart-sass'
beforeEach(() => {
jest.resetModules()
})
describe('Asset lookup', () => {
test('Hugo: should return valid version', async () => {
const octoVersionDetermination = new OctokitReleaseLookup()
const release = await octoVersionDetermination.getRelease(
Hugo.Org,
Hugo.Repo,
'',
HugoReleaseTransformer
)
expect(release.tag_name).toMatch(new RegExp('\\d+.\\d+.\\d+'))
const archiveUrl = release.assetUrl(new Platform(), false)
expect(archiveUrl).not.toBe(undefined)
})
test('Dart-Sass: should return valid version', async () => {
const octoVersionDetermination = new OctokitReleaseLookup()
const release = await octoVersionDetermination.getRelease(
DartSass.Org,
DartSass.Repo,
'',
DartSassReleaseTransformer
)
expect(release.tag_name).toMatch(new RegExp('\\d+.\\d+.\\d+'))
const archiveUrl = release.assetUrl(new Platform())
expect(archiveUrl).not.toBe(undefined)
})
})