4
0
Fork 0
mirror of https://github.com/Azure/setup-helm.git synced 2025-11-07 21:16:57 +00:00

chore: format code

This commit is contained in:
Paul Vollmer 2023-06-29 07:46:24 +02:00
parent 67a16f3bed
commit dc95ac6a4d
2 changed files with 24 additions and 12 deletions

View file

@ -27,17 +27,20 @@ describe('run.ts', () => {
jest.spyOn(os, 'arch').mockReturnValueOnce('unknown')
const helmLinuxUrl = 'https://test.tld/helm-v3.8.0-linux-amd64.zip'
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(helmLinuxUrl)
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(
helmLinuxUrl
)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
// arm64
jest.spyOn(os, 'type').mockReturnValue('Linux')
jest.spyOn(os, 'arch').mockReturnValueOnce('arm64')
const helmLinuxArm64Url =
'https://test.tld/helm-v3.8.0-linux-arm64.zip'
const helmLinuxArm64Url = 'https://test.tld/helm-v3.8.0-linux-arm64.zip'
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(helmLinuxArm64Url)
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(
helmLinuxArm64Url
)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
})
@ -49,17 +52,20 @@ describe('run.ts', () => {
jest.spyOn(os, 'arch').mockReturnValueOnce('unknown')
const helmDarwinUrl = 'https://test.tld/helm-v3.8.0-darwin-amd64.zip'
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(helmDarwinUrl)
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(
helmDarwinUrl
)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
// arm64
jest.spyOn(os, 'type').mockReturnValue('Darwin')
jest.spyOn(os, 'arch').mockReturnValueOnce('arm64')
const helmDarwinArm64Url =
'https://test.tld/helm-v3.8.0-darwin-arm64.zip'
const helmDarwinArm64Url = 'https://test.tld/helm-v3.8.0-darwin-arm64.zip'
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(helmDarwinArm64Url)
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(
helmDarwinArm64Url
)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
})
@ -74,7 +80,9 @@ describe('run.ts', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
const helmWindowsUrl = 'https://test.tld/helm-v3.8.0-windows-amd64.zip'
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(helmWindowsUrl)
expect(run.getHelmDownloadURL(downloadBaseURL, 'v3.8.0')).toBe(
helmWindowsUrl
)
expect(os.type).toBeCalled()
})

View file

@ -111,7 +111,7 @@ export function getHelmDownloadURL(baseURL: string, version: string): string {
const arch = os.arch()
const operatingSystem = os.type()
let urlPath = ""
let urlPath = ''
switch (true) {
case operatingSystem == LINUX && arch == ARM64:
@ -135,7 +135,10 @@ export function getHelmDownloadURL(baseURL: string, version: string): string {
return url.toString()
}
export async function downloadHelm(baseURL: string, version: string): Promise<string> {
export async function downloadHelm(
baseURL: string,
version: string
): Promise<string> {
let cachedToolpath = toolCache.find(helmToolName, version)
if (!cachedToolpath) {
let helmDownloadPath
@ -146,7 +149,8 @@ export async function downloadHelm(baseURL: string, version: string): Promise<st
} catch (exception) {
throw new Error(
`Failed to download Helm from location ${getHelmDownloadURL(
baseURL, version
baseURL,
version
)}`
)
}