mirror of
https://github.com/Azure/setup-kubectl.git
synced 2025-12-12 21:21:19 +00:00
chore: fix code style issues with Prettier
This commit is contained in:
parent
bba84b61af
commit
7990a9d4e3
2 changed files with 5 additions and 16 deletions
|
|
@ -12,7 +12,6 @@ import * as path from 'path'
|
|||
import * as core from '@actions/core'
|
||||
import * as util from 'util'
|
||||
|
||||
|
||||
describe('Testing all functions in run file.', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
|
|
@ -170,9 +169,7 @@ describe('Testing all functions in run file.', () => {
|
|||
expect(toolCache.downloadTool).not.toHaveBeenCalled()
|
||||
})
|
||||
test('getLatestPatchVersion() - download and return latest patch version', async () => {
|
||||
jest
|
||||
.spyOn(toolCache, 'downloadTool')
|
||||
.mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.27.15')
|
||||
|
||||
const result = await getLatestPatchVersion('1', '27')
|
||||
|
|
@ -184,9 +181,7 @@ describe('Testing all functions in run file.', () => {
|
|||
})
|
||||
|
||||
test('getLatestPatchVersion() - throw error when patch version is empty', async () => {
|
||||
jest
|
||||
.spyOn(toolCache, 'downloadTool')
|
||||
.mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('')
|
||||
|
||||
await expect(getLatestPatchVersion('1', '27')).rejects.toThrow(
|
||||
|
|
@ -204,9 +199,7 @@ describe('Testing all functions in run file.', () => {
|
|||
)
|
||||
})
|
||||
test('resolveKubectlVersion() - expands major.minor to latest patch', async () => {
|
||||
jest
|
||||
.spyOn(toolCache, 'downloadTool')
|
||||
.mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.27.15')
|
||||
|
||||
const result = await run.resolveKubectlVersion('1.27')
|
||||
|
|
@ -222,9 +215,7 @@ describe('Testing all functions in run file.', () => {
|
|||
expect(result).toBe('v1.27.15')
|
||||
})
|
||||
test('resolveKubectlVersion() - expands v-prefixed major.minor to latest patch', async () => {
|
||||
jest
|
||||
.spyOn(toolCache, 'downloadTool')
|
||||
.mockResolvedValue('pathToTool')
|
||||
jest.spyOn(toolCache, 'downloadTool').mockResolvedValue('pathToTool')
|
||||
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.27.15')
|
||||
|
||||
const result = await run.resolveKubectlVersion('v1.27')
|
||||
|
|
|
|||
|
|
@ -111,7 +111,5 @@ export async function resolveKubectlVersion(version: string): Promise<string> {
|
|||
}
|
||||
|
||||
// User provided a full version such as 1.27.15, ensure it has a 'v' prefix.
|
||||
return cleanedVersion.startsWith('v')
|
||||
? cleanedVersion
|
||||
: `v${cleanedVersion}`
|
||||
return cleanedVersion.startsWith('v') ? cleanedVersion : `v${cleanedVersion}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue