Skip to content

Commit 03185b7

Browse files
committed
Save cache only on cache miss
1 parent 7fadaea commit 03185b7

File tree

7 files changed

+205
-387
lines changed

7 files changed

+205
-387
lines changed

__tests__/entrypoint.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as _core from '@actions/core'
2+
import * as _cache from '@actions/cache'
23
import * as _lein from '../src/leiningen'
34
import * as _boot from '../src/boot'
45
import * as _cli from '../src/cli'
@@ -13,6 +14,9 @@ import {main} from '../src/entrypoint'
1314
jest.mock('@actions/core')
1415
const core: jest.Mocked<typeof _core> = _core as never
1516

17+
jest.mock('@actions/cache')
18+
const cache: jest.Mocked<typeof _cache> = _cache as never
19+
1620
jest.mock('../src/leiningen')
1721
const lein: jest.Mocked<typeof _lein> = _lein as never
1822

@@ -48,6 +52,19 @@ describe('setup-clojure', () => {
4852
inputs = {}
4953
core.getInput.mockImplementation(key => inputs[key])
5054
core.getState.mockImplementation(() => 'main')
55+
cache.restoreCache.mockImplementation(
56+
async (
57+
_paths,
58+
_primaryKey,
59+
_restoreKeys,
60+
_options,
61+
_enableCrossOsArchive
62+
) => Promise.resolve('')
63+
)
64+
cache.saveCache.mockImplementation(
65+
async (_paths, _key, _enableCrossOsArchive, _options) =>
66+
Promise.resolve(0)
67+
)
5168
})
5269

5370
it('sets up Leiningen', async () => {

0 commit comments

Comments
 (0)