mirror of https://github.com/actions/toolkit
Fix tests
parent
7409ad5fae
commit
15fefd9336
|
@ -84,7 +84,7 @@ $ npm install @actions/artifact --save
|
||||||
|
|
||||||
:dart: [@actions/cache](packages/cache)
|
:dart: [@actions/cache](packages/cache)
|
||||||
|
|
||||||
Provides functions to interact with actions cache. Read more [here](packages/cache)
|
Provides functions to cache dependencies and build outputs to improve workflow execution time.. Read more [here](packages/cache)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm install @actions/cache --save
|
$ npm install @actions/cache --save
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# @actions/cache Releases
|
# @actions/cache Releases
|
||||||
|
|
||||||
### 0.0.0
|
### 1.0.0
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
|
@ -57,8 +57,7 @@ test('restore with no cache found', async () => {
|
||||||
const key = 'node-test'
|
const key = 'node-test'
|
||||||
|
|
||||||
const infoMock = jest.spyOn(core, 'info')
|
const infoMock = jest.spyOn(core, 'info')
|
||||||
const clientMock = jest.spyOn(cacheHttpClient, 'getCacheEntry')
|
jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(async () => {
|
||||||
clientMock.mockImplementation(async () => {
|
|
||||||
return Promise.resolve(null)
|
return Promise.resolve(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -74,8 +73,7 @@ test('restore with server error should fail', async () => {
|
||||||
const paths = ['node_modules']
|
const paths = ['node_modules']
|
||||||
const key = 'node-test'
|
const key = 'node-test'
|
||||||
|
|
||||||
const clientMock = jest.spyOn(cacheHttpClient, 'getCacheEntry')
|
jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(() => {
|
||||||
clientMock.mockImplementation(() => {
|
|
||||||
throw new Error('HTTP Error Occurred')
|
throw new Error('HTTP Error Occurred')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -91,8 +89,7 @@ test('restore with restore keys and no cache found', async () => {
|
||||||
|
|
||||||
const infoMock = jest.spyOn(core, 'info')
|
const infoMock = jest.spyOn(core, 'info')
|
||||||
|
|
||||||
const clientMock = jest.spyOn(cacheHttpClient, 'getCacheEntry')
|
jest.spyOn(cacheHttpClient, 'getCacheEntry').mockImplementation(async () => {
|
||||||
clientMock.mockImplementation(async () => {
|
|
||||||
return Promise.resolve(null)
|
return Promise.resolve(null)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ test('save with large cache outputs should fail', async () => {
|
||||||
const createTarMock = jest.spyOn(tar, 'createTar')
|
const createTarMock = jest.spyOn(tar, 'createTar')
|
||||||
|
|
||||||
const cacheSize = 6 * 1024 * 1024 * 1024 //~6GB, over the 5GB limit
|
const cacheSize = 6 * 1024 * 1024 * 1024 //~6GB, over the 5GB limit
|
||||||
jest.spyOn(cacheUtils, 'getArchiveFileSize').mockReturnValue(cacheSize)
|
jest.spyOn(cacheUtils, 'getArchiveFileSize').mockReturnValueOnce(cacheSize)
|
||||||
const compression = CompressionMethod.Gzip
|
const compression = CompressionMethod.Gzip
|
||||||
const getCompressionMock = jest
|
const getCompressionMock = jest
|
||||||
.spyOn(cacheUtils, 'getCompressionMethod')
|
.spyOn(cacheUtils, 'getCompressionMethod')
|
||||||
|
@ -108,7 +108,7 @@ test('save with server error should fail', async () => {
|
||||||
|
|
||||||
const saveCacheMock = jest
|
const saveCacheMock = jest
|
||||||
.spyOn(cacheHttpClient, 'saveCache')
|
.spyOn(cacheHttpClient, 'saveCache')
|
||||||
.mockImplementationOnce(async () => {
|
.mockImplementationOnce(() => {
|
||||||
throw new Error('HTTP Error Occurred')
|
throw new Error('HTTP Error Occurred')
|
||||||
})
|
})
|
||||||
const compression = CompressionMethod.Zstd
|
const compression = CompressionMethod.Zstd
|
||||||
|
@ -116,7 +116,7 @@ test('save with server error should fail', async () => {
|
||||||
.spyOn(cacheUtils, 'getCompressionMethod')
|
.spyOn(cacheUtils, 'getCompressionMethod')
|
||||||
.mockReturnValueOnce(Promise.resolve(compression))
|
.mockReturnValueOnce(Promise.resolve(compression))
|
||||||
|
|
||||||
await expect(await saveCache([filePath], primaryKey)).rejects.toThrowError(
|
await expect(saveCache([filePath], primaryKey)).rejects.toThrowError(
|
||||||
'HTTP Error Occurred'
|
'HTTP Error Occurred'
|
||||||
)
|
)
|
||||||
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
expect(reserveCacheMock).toHaveBeenCalledTimes(1)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "0.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@actions/cache",
|
"name": "@actions/cache",
|
||||||
"version": "0.0.0",
|
"version": "1.0.0",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions artifact cache lib",
|
"description": "Actions cache lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
"actions",
|
"actions",
|
||||||
|
|
Loading…
Reference in New Issue