1
0
Fork 0

Added unit test case for #624

pull/1097/head
Sankalp Kotewar 2022-05-23 06:32:13 +00:00 committed by GitHub
parent b9fefecf57
commit 07b91eafe5
1 changed files with 11 additions and 0 deletions

View File

@ -290,3 +290,14 @@ test('save with valid inputs uploads a cache', async () => {
expect(saveCacheMock).toHaveBeenCalledWith(cacheId, archiveFile, undefined) expect(saveCacheMock).toHaveBeenCalledWith(cacheId, archiveFile, undefined)
expect(getCompressionMock).toHaveBeenCalledTimes(1) 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.`
)
})