Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run pre-checkin script
  • Loading branch information
domdomegg committed Mar 16, 2023
commit c78a7a14b31048713e3a603719916b6813523fcb
32 changes: 17 additions & 15 deletions __tests__/nightly-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('setup-node', () => {
const workingUrls = [
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
]
];

inputs['node-version'] = versionSpec;
inputs['always-auth'] = false;
Expand All @@ -296,25 +296,25 @@ describe('setup-node', () => {
findSpy.mockImplementation(() => '');
findAllVersionsSpy.mockImplementation(() => []);

dlSpy.mockImplementation(async (url) => {
dlSpy.mockImplementation(async url => {
if (workingUrls.includes(url)) {
return '/some/temp/path'
return '/some/temp/path';
}

throw new tc.HTTPError(404)
throw new tc.HTTPError(404);
});
const toolPath = path.normalize(
'/cache/node/13.13.1-nightly20200415947ddec091/x64'
);
cacheSpy.mockImplementation(async () => toolPath);
mkdirpSpy.mockImplementation(async () => {})
cpSpy.mockImplementation(async () => {})
mkdirpSpy.mockImplementation(async () => {});
cpSpy.mockImplementation(async () => {});

await main.run();

workingUrls.forEach(url => {
expect(dlSpy).toHaveBeenCalledWith(url);
})
});
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${toolPath}${osm.EOL}`);
});

Expand All @@ -328,7 +328,7 @@ describe('setup-node', () => {
const workingUrls = [
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.exe`,
`https://nodejs.org/download/nightly/v${versionSpec}/win-x64/node.lib`
]
];

inputs['node-version'] = versionSpec;
inputs['always-auth'] = false;
Expand All @@ -338,26 +338,28 @@ describe('setup-node', () => {
findSpy.mockImplementation(() => '');
findAllVersionsSpy.mockImplementation(() => []);

dlSpy.mockImplementation(async (url) => {
dlSpy.mockImplementation(async url => {
if (workingUrls.includes(url)) {
return '/some/temp/path'
return '/some/temp/path';
}

throw new tc.HTTPError(404)
throw new tc.HTTPError(404);
});
const toolPath = path.normalize(
'/cache/node/13.13.1-nightly20200415947ddec091/x64'
);
cacheSpy.mockImplementation(async () => toolPath);
mkdirpSpy.mockImplementation(async () => {})
cpSpy.mockImplementation(async () => {})
mkdirpSpy.mockImplementation(async () => {});
cpSpy.mockImplementation(async () => {});

await main.run();

workingUrls.forEach(url => {
expect(dlSpy).not.toHaveBeenCalledWith(url);
})
expect(cnSpy).toHaveBeenCalledWith(`::error::Unexpected HTTP response: 404${osm.EOL}`);
});
expect(cnSpy).toHaveBeenCalledWith(
`::error::Unexpected HTTP response: 404${osm.EOL}`
);
});

it('does not find a version that does not exist', async () => {
Expand Down
Loading