Initial changes

This commit is contained in:
Shubham Tiwari
2022-06-20 04:22:20 +00:00
committed by GitHub
parent 9b7bcb1567
commit e051715283
3 changed files with 61 additions and 40 deletions

View File

@@ -73,14 +73,16 @@ test('restore with no cache found', async () => {
test('restore with server error should fail', async () => {
const paths = ['node_modules']
const key = 'node-test'
const logWarningMock = jest.spyOn(core, "warning");
jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(() => {
throw new Error('HTTP Error Occurred')
})
await expect(restoreCache(paths, key)).rejects.toThrowError(
'HTTP Error Occurred'
)
const cacheKey = await restoreCache(paths, key)
expect(cacheKey).toBe(undefined)
expect(logWarningMock).toHaveBeenCalledTimes(1)
expect(logWarningMock).toHaveBeenCalledWith('Fail to restore: Error: HTTP Error Occurred')
})
test('restore with restore keys and no cache found', async () => {