amend unit tests

This commit is contained in:
panticmilos 2022-05-09 17:35:52 +02:00
parent 07e689a783
commit bd4ffc78c2
4 changed files with 12 additions and 28 deletions

View file

@ -920,10 +920,6 @@ describe('setup-node', () => {
os.platform = 'darwin';
os.arch = 'x64';
const expectedVersion = nodeTestDist[0];
let expectedUrl = `https://nodejs.org/dist/${expectedVersion.version}/node-${expectedVersion.version}-${os.platform}-${os.arch}.tar.gz`;
findSpy.mockImplementation(() => '');
getManifestSpy.mockImplementation(() => {
throw new Error('Unable to download manifest');
@ -932,21 +928,10 @@ describe('setup-node', () => {
// Act
await main.run();
// Assert
expect(logSpy).toHaveBeenCalledWith(
`Attempting to download ${inputVersion}...`
);
// assert
expect(logSpy).toHaveBeenCalledWith('Unable to download manifest');
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
expect(logSpy).toHaveBeenCalledWith(
`Acquiring ${expectedVersion.version.substring(
1,
expectedVersion.version.length
)} - ${os.arch} from ${expectedUrl}`
);
}
);
});

18
package-lock.json generated
View file

@ -20,7 +20,7 @@
"semver": "^6.1.1"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/jest": "^27.5.0",
"@types/node": "^16.11.25",
"@types/semver": "^6.0.0",
"@zeit/ncc": "^0.21.0",
@ -1471,12 +1471,12 @@
}
},
"node_modules/@types/jest": {
"version": "27.0.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz",
"integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==",
"version": "27.5.0",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz",
"integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==",
"dev": true,
"dependencies": {
"jest-diff": "^27.0.0",
"jest-matcher-utils": "^27.0.0",
"pretty-format": "^27.0.0"
}
},
@ -6283,12 +6283,12 @@
}
},
"@types/jest": {
"version": "27.0.2",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.0.2.tgz",
"integrity": "sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==",
"version": "27.5.0",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.0.tgz",
"integrity": "sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==",
"dev": true,
"requires": {
"jest-diff": "^27.0.0",
"jest-matcher-utils": "^27.0.0",
"pretty-format": "^27.0.0"
}
},

View file

@ -34,7 +34,7 @@
"semver": "^6.1.1"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/jest": "^27.5.0",
"@types/node": "^16.11.25",
"@types/semver": "^6.0.0",
"@zeit/ncc": "^0.21.0",

View file

@ -7,7 +7,6 @@ import * as tc from '@actions/tool-cache';
import * as path from 'path';
import * as semver from 'semver';
import fs = require('fs');
import * as installer from './installer';
//
// Node versions interface
@ -372,7 +371,7 @@ async function queryDistForMatch(
}
let versions: string[] = [];
let nodeVersions = await installer.getVersionsFromDist();
let nodeVersions = await getVersionsFromDist();
if (
versionSpec === 'current' ||