1
0
Fork 0
mirror of https://github.com/actions/toolkit synced 2025-05-08 16:17:40 +00:00

Change variable path to a list

This commit is contained in:
Aiqiao Yan 2020-05-06 17:53:22 -04:00
parent 932779cf58
commit 7409ad5fae
9 changed files with 216 additions and 414 deletions

View file

@ -1,17 +1,25 @@
import {getCacheVersion} from '../src/internal/cacheHttpClient'
import {CompressionMethod} from '../src/internal/constants'
test('getCacheVersion with path input and compression method undefined returns version', async () => {
const inputPath = 'node_modules'
const result = getCacheVersion(inputPath)
test('getCacheVersion with one path returns version', async () => {
const paths = ['node_modules']
const result = getCacheVersion(paths)
expect(result).toEqual(
'b3e0c6cb5ecf32614eeb2997d905b9c297046d7cbf69062698f25b14b4cb0985'
)
})
test('getCacheVersion with multiple paths returns version', async () => {
const paths = ['node_modules', 'dist']
const result = getCacheVersion(paths)
expect(result).toEqual(
'165c3053bc646bf0d4fac17b1f5731caca6fe38e0e464715c0c3c6b6318bf436'
)
})
test('getCacheVersion with zstd compression returns version', async () => {
const inputPath = 'node_modules'
const result = getCacheVersion(inputPath, CompressionMethod.Zstd)
const paths = ['node_modules']
const result = getCacheVersion(paths, CompressionMethod.Zstd)
expect(result).toEqual(
'273877e14fd65d270b87a198edbfa2db5a43de567c9a548d2a2505b408befe24'
@ -19,8 +27,8 @@ test('getCacheVersion with zstd compression returns version', async () => {
})
test('getCacheVersion with gzip compression does not change vesion', async () => {
const inputPath = 'node_modules'
const result = getCacheVersion(inputPath, CompressionMethod.Gzip)
const paths = ['node_modules']
const result = getCacheVersion(paths, CompressionMethod.Gzip)
expect(result).toEqual(
'b3e0c6cb5ecf32614eeb2997d905b9c297046d7cbf69062698f25b14b4cb0985'