mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 04:44:46 +00:00
unit tests
This commit is contained in:
parent
9a03ebd9cc
commit
fd1b409bc3
3 changed files with 43 additions and 13 deletions
|
@ -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...');
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue