unit tests

This commit is contained in:
panticmilos 2022-05-19 17:33:13 +02:00
parent 9a03ebd9cc
commit fd1b409bc3
3 changed files with 43 additions and 13 deletions

View file

@ -913,4 +913,31 @@ describe('setup-node', () => {
}
);
});
describe('latest alias syntax from cache', () => {
it.each(['latest', 'current', 'node'])(
'download the %s version if alias is provided',
async inputVersion => {
// Arrange
inputs['node-version'] = inputVersion;
const expectedVersion = nodeTestDist[0];
os.platform = 'darwin';
os.arch = 'x64';
const toolPath = path.normalize(
`/cache/node/${expectedVersion.version}/x64`
);
findSpy.mockReturnValue(toolPath);
// Act
await main.run();
// assert
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
}
);
});
});