tests(withdeploy): add tests for withdeploy
This commit is contained in:
parent
35de0fc568
commit
a7950b9ce3
4 changed files with 41 additions and 10 deletions
|
@ -29,4 +29,32 @@ describe('Install Hugo', () => {
|
||||||
})
|
})
|
||||||
).not.toThrow()
|
).not.toThrow()
|
||||||
}, 30_000)
|
}, 30_000)
|
||||||
|
|
||||||
|
test('Download latest Hugo - extended', 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',
|
||||||
|
extended: true
|
||||||
|
})
|
||||||
|
).not.toThrow()
|
||||||
|
}, 30_000)
|
||||||
|
|
||||||
|
test('Download latest Hugo - with deploy', 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',
|
||||||
|
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();
|
const tmpDir = external_node_os_namespaceObject.tmpdir();
|
||||||
let versionSpec = release.tag_name;
|
let versionSpec = release.tag_name;
|
||||||
if (cmd.extended) {
|
if (cmd.extended) {
|
||||||
versionSpec += '+extended';
|
versionSpec = `${release.tag_name}+extended`;
|
||||||
}
|
}
|
||||||
if (cmd.withDeploy) {
|
else if (cmd.withDeploy) {
|
||||||
versionSpec += '+withdeploy';
|
versionSpec = `${release.tag_name}+extended+withdeploy`;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
const cachedTool = tool_cache.find(Hugo.Name, versionSpec, this.platform.arch);
|
||||||
|
@ -50832,7 +50832,7 @@ class HugoInstaller {
|
||||||
catch (e) {
|
catch (e) {
|
||||||
core.warning(`Failed to lookup tool in cache: ${errorMsg(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) {
|
if (!toolUrl) {
|
||||||
throw new Error('No matching URL detected for given platform');
|
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
|
let versionSpec = release.tag_name
|
||||||
if (cmd.extended) {
|
if (cmd.extended) {
|
||||||
versionSpec += '+extended'
|
versionSpec = `${release.tag_name}+extended`
|
||||||
}
|
} else if (cmd.withDeploy) {
|
||||||
if (cmd.withDeploy) {
|
versionSpec = `${release.tag_name}+extended+withdeploy`
|
||||||
versionSpec += '+withdeploy'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -59,7 +58,11 @@ export class HugoInstaller {
|
||||||
core.warning(`Failed to lookup tool in cache: ${errorMsg(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) {
|
if (!toolUrl) {
|
||||||
throw new Error('No matching URL detected for given platform')
|
throw new Error('No matching URL detected for given platform')
|
||||||
|
|
Loading…
Reference in a new issue