tests(withdeploy): add tests for withdeploy
This commit is contained in:
parent
35de0fc568
commit
d7ba37343c
5 changed files with 50 additions and 11 deletions
|
@ -43,6 +43,8 @@ jobs:
|
|||
- name: Test
|
||||
id: npm-ci-test
|
||||
run: npm run ci-test
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RENOVATE_GITHUB_TOKEN }}
|
||||
|
||||
test-action:
|
||||
name: GitHub Actions Test
|
||||
|
|
|
@ -18,7 +18,9 @@ afterEach(() => {
|
|||
|
||||
describe('Install Hugo', () => {
|
||||
test('Download latest Hugo', async () => {
|
||||
const releaseLookup = new OctokitReleaseLookup()
|
||||
const releaseLookup = new OctokitReleaseLookup(
|
||||
process.env.GITHUB_TOKEN || undefined
|
||||
)
|
||||
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||
|
||||
|
@ -29,4 +31,36 @@ describe('Install Hugo', () => {
|
|||
})
|
||||
).not.toThrow()
|
||||
}, 30_000)
|
||||
|
||||
test('Download latest Hugo - extended', async () => {
|
||||
const releaseLookup = new OctokitReleaseLookup(
|
||||
process.env.GITHUB_TOKEN || undefined
|
||||
)
|
||||
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||
|
||||
expect(
|
||||
async () =>
|
||||
await hugo.install({
|
||||
version: 'latest',
|
||||
extended: true
|
||||
})
|
||||
).not.toThrow()
|
||||
}, 30_000)
|
||||
|
||||
test('Download latest Hugo - with deploy', async () => {
|
||||
const releaseLookup = new OctokitReleaseLookup(
|
||||
process.env.GITHUB_TOKEN || undefined
|
||||
)
|
||||
const platformMock = new Platform('linux', undefined, { HOME: tmpDir })
|
||||
const hugo = new HugoInstaller(releaseLookup, platformMock)
|
||||
|
||||
expect(
|
||||
async () =>
|
||||
await hugo.install({
|
||||
version: 'latest',
|
||||
withDeploy: true
|
||||
})
|
||||
).not.toThrow()
|
||||
}, 30_000)
|
||||
})
|
||||
|
|
8
dist/index.js
vendored
8
dist/index.js
vendored
|
@ -50817,10 +50817,10 @@ class HugoInstaller {
|
|||
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
||||
let versionSpec = release.tag_name;
|
||||
if (cmd.extended) {
|
||||
versionSpec += '+extended';
|
||||
versionSpec = `${release.tag_name}+extended`;
|
||||
}
|
||||
if (cmd.withDeploy) {
|
||||
versionSpec += '+withdeploy';
|
||||
else if (cmd.withDeploy) {
|
||||
versionSpec = `${release.tag_name}+extended+withdeploy`;
|
||||
}
|
||||
try {
|
||||
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
||||
|
@ -50832,7 +50832,7 @@ class HugoInstaller {
|
|||
catch (e) {
|
||||
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`);
|
||||
}
|
||||
const toolUrl = release.assetUrl(this.platform, cmd.extended);
|
||||
const toolUrl = release.assetUrl(this.platform, cmd.extended, cmd.withDeploy);
|
||||
if (!toolUrl) {
|
||||
throw new Error('No matching URL detected for given platform');
|
||||
}
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
13
src/hugo.ts
13
src/hugo.ts
|
@ -43,10 +43,9 @@ export class HugoInstaller {
|
|||
|
||||
let versionSpec = release.tag_name
|
||||
if (cmd.extended) {
|
||||
versionSpec += '+extended'
|
||||
}
|
||||
if (cmd.withDeploy) {
|
||||
versionSpec += '+withdeploy'
|
||||
versionSpec = `${release.tag_name}+extended`
|
||||
} else if (cmd.withDeploy) {
|
||||
versionSpec = `${release.tag_name}+extended+withdeploy`
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -59,7 +58,11 @@ export class HugoInstaller {
|
|||
core.warning(`Failed to lookup tool in cache: ${errorMsg(e)}`)
|
||||
}
|
||||
|
||||
const toolUrl = release.assetUrl(this.platform, cmd.extended)
|
||||
const toolUrl = release.assetUrl(
|
||||
this.platform,
|
||||
cmd.extended,
|
||||
cmd.withDeploy
|
||||
)
|
||||
|
||||
if (!toolUrl) {
|
||||
throw new Error('No matching URL detected for given platform')
|
||||
|
|
Loading…
Reference in a new issue