mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-15 09:08:06 +08:00
Initial changes
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user