Skip to content

Commit 30b9ddf

Browse files
Merge pull request #264 from e-korolevskii/258-not-throw-err-no-cache-folders
Not throw err no cache folder
2 parents 4c32251 + c4e1698 commit 30b9ddf

File tree

4 files changed

+853
-844
lines changed

4 files changed

+853
-844
lines changed

__tests__/setup-go.test.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ describe('setup-go', () => {
295295
findSpy.mockImplementation(() => toolPath);
296296
await main.run();
297297

298-
let expPath = path.join(toolPath, 'bin');
299298
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
300299
});
301300

@@ -462,9 +461,6 @@ describe('setup-go', () => {
462461
inputs['go-version'] = versionSpec;
463462
inputs['token'] = 'faketoken';
464463

465-
let expectedUrl =
466-
'https://github.com/actions/go-versions/releases/download/1.12.14-20200616.18/go-1.12.14-linux-x64.tar.gz';
467-
468464
// ... but not in the local cache
469465
findSpy.mockImplementation(() => '');
470466

@@ -526,7 +522,7 @@ describe('setup-go', () => {
526522
});
527523

528524
mkdirpSpy.mockImplementation(async () => {});
529-
existsSpy.mockImplementation(path => {
525+
existsSpy.mockImplementation(() => {
530526
return false;
531527
});
532528

@@ -707,8 +703,6 @@ describe('setup-go', () => {
707703
const toolPath = path.normalize('/cache/go/1.17.5/x64');
708704
extractTarSpy.mockImplementation(async () => '/some/other/temp/path');
709705
cacheSpy.mockImplementation(async () => toolPath);
710-
const expectedUrl =
711-
'https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz';
712706

713707
await main.run();
714708

@@ -834,7 +828,7 @@ exclude example.com/thismodule v1.3.0
834828

835829
it('reads version from go.mod', async () => {
836830
inputs['go-version-file'] = 'go.mod';
837-
existsSpy.mockImplementation(path => true);
831+
existsSpy.mockImplementation(() => true);
838832
readFileSpy.mockImplementation(() => Buffer.from(goModContents));
839833

840834
await main.run();
@@ -846,7 +840,7 @@ exclude example.com/thismodule v1.3.0
846840

847841
it('reads version from .go-version', async () => {
848842
inputs['go-version-file'] = '.go-version';
849-
existsSpy.mockImplementation(path => true);
843+
existsSpy.mockImplementation(() => true);
850844
readFileSpy.mockImplementation(() => Buffer.from(`1.13.0${osm.EOL}`));
851845

852846
await main.run();
@@ -859,7 +853,7 @@ exclude example.com/thismodule v1.3.0
859853
it('is overwritten by go-version', async () => {
860854
inputs['go-version'] = '1.13.1';
861855
inputs['go-version-file'] = 'go.mod';
862-
existsSpy.mockImplementation(path => true);
856+
existsSpy.mockImplementation(() => true);
863857
readFileSpy.mockImplementation(() => Buffer.from(goModContents));
864858

865859
await main.run();
@@ -871,7 +865,7 @@ exclude example.com/thismodule v1.3.0
871865

872866
it('reports a read failure', async () => {
873867
inputs['go-version-file'] = 'go.mod';
874-
existsSpy.mockImplementation(path => false);
868+
existsSpy.mockImplementation(() => false);
875869

876870
await main.run();
877871

0 commit comments

Comments
 (0)