Vendored snapshot of setup-dotnet@v5 (no upstream history)
e2e tests / test-setup-multiple-versions (ubuntu-latest) (push) Failing after 15s
e2e tests / test-setup-full-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-without-patch-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-prerelease-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-latest-patch-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-ABCxx-syntax (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-with-wildcard (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-global-json-specified-and-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestmajor (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestfeature (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestpatch (ubuntu-latest) (push) Failing after 8s
e2e tests / test-global-json-with-comments (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-with-dotnet-quality (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-with-cache (ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-cache-dependency-path (ubuntu-latest) (push) Failing after 5s
e2e tests / test-dotnet-version-output-during-single-version-installation (ubuntu-latest) (push) Failing after 6s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (ubuntu-latest) (push) Failing after 5s
e2e tests / test-bypass-proxy (push) Failing after 5s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-workloads-input (ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-architecture-input (x64, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-latest-version (ubuntu-latest) (push) Failing after 5s
Validate dotnet / setup-version (10.0, ubuntu-latest) (push) Failing after 5s
Validate dotnet / setup-version (8.0, ubuntu-latest) (push) Failing after 6s
Validate dotnet / setup-version (9.0, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-prerelease-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (windows-latest) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (macos-15-intel) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (macos-latest) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestmajor (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestmajor (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestfeature (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (arm64, macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (x64, macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (x64, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestfeature (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-with-channel-abcxx (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestpatch (windows-latest) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (macos-15-intel) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestpatch (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, macos-15-intel) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, macos-15-intel) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, ubuntu-22.04) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, windows-latest) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (windows-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-cache (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-cache (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, ubuntu-22.04) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-full-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (windows-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (macos-15-intel) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (macos-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (windows-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (macos-15-intel) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (macos-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (windows-latest) (push) Canceled after 0s
e2e tests / test-proxy (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (macos-latest) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, macos-15-intel) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, macos-latest) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (ubuntu-latest) (push) Failing after 15s
e2e tests / test-setup-full-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-without-patch-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-prerelease-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-latest-patch-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-ABCxx-syntax (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-with-wildcard (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-global-json-specified-and-version (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestmajor (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestfeature (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-global-json-rollforward-latestpatch (ubuntu-latest) (push) Failing after 8s
e2e tests / test-global-json-with-comments (ubuntu-latest) (push) Failing after 7s
e2e tests / test-setup-with-dotnet-quality (ubuntu-latest) (push) Failing after 6s
e2e tests / test-setup-with-cache (ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-cache-dependency-path (ubuntu-latest) (push) Failing after 5s
e2e tests / test-dotnet-version-output-during-single-version-installation (ubuntu-latest) (push) Failing after 6s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (ubuntu-latest) (push) Failing after 5s
e2e tests / test-bypass-proxy (push) Failing after 5s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-workloads-input (ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-with-architecture-input (x64, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-latest-version (ubuntu-latest) (push) Failing after 5s
Validate dotnet / setup-version (10.0, ubuntu-latest) (push) Failing after 5s
Validate dotnet / setup-version (8.0, ubuntu-latest) (push) Failing after 6s
Validate dotnet / setup-version (9.0, ubuntu-latest) (push) Failing after 5s
e2e tests / test-setup-prerelease-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-latest-patch-version (windows-latest) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (macos-15-intel) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (macos-latest) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-ABCxx-syntax (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-wildcard (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-global-json-specified-and-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestmajor (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestmajor (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestfeature (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (arm64, macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (x64, macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-architecture-input (x64, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestfeature (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-latest-with-channel-abcxx (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestpatch (windows-latest) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (macos-15-intel) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-global-json-rollforward-latestpatch (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (10.0, macos-15-intel) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, macos-15-intel) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, ubuntu-22.04) (push) Canceled after 0s
Validate dotnet / setup-version (8.0, windows-latest) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-global-json-with-comments (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-dotnet-quality (windows-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-cache (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-cache (macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, macos-latest) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, ubuntu-22.04) (push) Canceled after 0s
Validate dotnet / setup-version (9.0, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-multiple-versions (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-full-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-full-version (windows-latest) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-without-patch-version (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-setup-with-cache-dependency-path (windows-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (macos-15-intel) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (macos-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-single-version-installation (windows-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (macos-15-intel) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (macos-latest) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-dotnet-version-output-during-multiple-version-installation (windows-latest) (push) Canceled after 0s
e2e tests / test-proxy (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-prerelease-version (macos-latest) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, macos-15-intel) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, macos-latest) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, ubuntu-22.04) (push) Canceled after 0s
e2e tests / test-sequential-version-installation (10.0.101, 9.0.308, windows-latest) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (macos-15-intel) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (macos-latest) (push) Canceled after 0s
e2e tests / test-setup-with-workloads-input (windows-latest) (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import fs from 'node:fs';
|
||||
import {run} from '../src/cache-save';
|
||||
import {getNuGetFolderPath} from '../src/cache-utils';
|
||||
import {State} from '../src/constants';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('node:fs');
|
||||
jest.mock('../src/cache-utils');
|
||||
|
||||
describe('cache-save tests', () => {
|
||||
beforeAll(() => {
|
||||
jest.mocked(getNuGetFolderPath).mockResolvedValue({
|
||||
'global-packages': 'global-packages',
|
||||
'http-cache': 'http-cache',
|
||||
temp: 'temp',
|
||||
'plugins-cache': 'plugins-cache'
|
||||
});
|
||||
});
|
||||
beforeEach(() => {
|
||||
jest.mocked(core.setFailed).mockClear();
|
||||
jest.mocked(core.getState).mockClear();
|
||||
jest.mocked(core.setOutput).mockClear();
|
||||
jest.mocked(cache.saveCache).mockClear();
|
||||
jest.mocked(fs.existsSync).mockClear();
|
||||
});
|
||||
|
||||
it('does not save cache when inputs:cache === false', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(false);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(fs.existsSync)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not save cache when core.getState("CACHE_KEY") returns ""', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('');
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(fs.existsSync)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('throws Error when cachePath not exists', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('cache-key');
|
||||
jest.mocked(fs.existsSync).mockReturnValue(false);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not save cache when state.CACHE_KEY === state.CACHE_RESULT', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('cache-key');
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('saves cache when state.CACHE_KEY !== state.CACHE_RESULT', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockImplementation(s => s);
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not fail and traces when saveCache returns -1', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockImplementation(s => s);
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
jest.mocked(cache.saveCache).mockResolvedValue(-1);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).toHaveBeenCalled();
|
||||
expect(jest.mocked(core.debug)).toHaveBeenCalledWith(
|
||||
`Cache was not saved for the key: ${State.CachePrimaryKey}`
|
||||
);
|
||||
expect(jest.mocked(core.info)).not.toHaveBeenCalledWith(
|
||||
`Cache saved with the key: ${State.CachePrimaryKey}`
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user