switching to fetching latest version from the dedicated file (#130)

This commit is contained in:
elProxy
2024-03-01 17:15:56 +01:00
committed by GitHub
parent efbd96d464
commit ec8dd7c209
3 changed files with 17 additions and 29 deletions

View File

@ -86,7 +86,18 @@ describe('run.ts', () => {
expect(os.type).toHaveBeenCalled()
})
test('getLatestHelmVersion() - return the stable version of HELM since its not authenticated', async () => {
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
const res = {
status: 200,
text: async () => 'v9.99.999'
} as Response
global.fetch = jest.fn().mockReturnValue(res)
expect(await run.getLatestHelmVersion()).toBe('v9.99.999')
})
test('getLatestHelmVersion() - return the stable version of HELM when simulating a network error', async () => {
const errorMessage: string = 'Network Error'
global.fetch = jest.fn().mockRejectedValueOnce(new Error(errorMessage))
expect(await run.getLatestHelmVersion()).toBe('v3.13.3')
})