mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2025-08-19 19:59:12 +08:00
Added unit test case for #624
This commit is contained in:
parent
b9fefecf57
commit
07b91eafe5
11
packages/cache/__tests__/saveCache.test.ts
vendored
11
packages/cache/__tests__/saveCache.test.ts
vendored
@ -290,3 +290,14 @@ test('save with valid inputs uploads a cache', async () => {
|
||||
expect(saveCacheMock).toHaveBeenCalledWith(cacheId, archiveFile, undefined)
|
||||
expect(getCompressionMock).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('save with non existing path should not save cache', async () => {
|
||||
const paths: string[] = ['aPathThatDoesnotExist']
|
||||
const primaryKey = 'Linux-node-bb828da54c148048dd17899ba9fda624811cfb43'
|
||||
jest.spyOn(cacheUtils, 'resolvePaths').mockImplementation(async filePaths => {
|
||||
return []
|
||||
})
|
||||
await expect(saveCache(paths, primaryKey)).rejects.toThrowError(
|
||||
`Path Validation Error: Path(s) specified in the action do not exist, hence no cache is being saved.`
|
||||
)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user