Skip to content

Commit 4b20cd3

Browse files
Update unit-tests
1 parent 44d36cc commit 4b20cd3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

__tests__/installer.test.ts

+44
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,50 @@ describe('installer tests', () => {
125125
expect(scriptArguments).toContain(expectedArgument);
126126
});
127127

128+
it(`should supply 'runtime' argument to the installation script if runtimeOnly parameter is true`, async () => {
129+
const inputVersion = '6.0.300';
130+
const inputQuality = '' as QualityOptions;
131+
const stdout = `Fictitious dotnet version ${inputVersion} is installed`;
132+
133+
const resolvedVersion = await new installer.DotnetVersionResolver(
134+
inputVersion
135+
).createDotnetVersion();
136+
137+
getExecOutputSpy.mockImplementation(() => {
138+
return Promise.resolve({
139+
exitCode: 0,
140+
stdout: `${stdout}`,
141+
stderr: ''
142+
});
143+
});
144+
maxSatisfyingSpy.mockImplementation(() => inputVersion);
145+
146+
const dotnetInstaller = new installer.DotnetCoreInstaller(
147+
resolvedVersion,
148+
inputQuality,
149+
true
150+
);
151+
152+
await dotnetInstaller.installDotnet();
153+
154+
/**
155+
* First time script would be called to
156+
* install runtime of the latest version in order
157+
* to provide latest CLI, here we are checking only the
158+
* second one that installs actual requested runtime
159+
*/
160+
const callIndex = 1;
161+
162+
const scriptArguments = (
163+
getExecOutputSpy.mock.calls[callIndex][1] as string[]
164+
).join(' ');
165+
const expectedArgument = IS_WINDOWS
166+
? `-Runtime`
167+
: `--runtime`;
168+
169+
expect(scriptArguments).toContain(expectedArgument);
170+
});
171+
128172
it(`should warn if the 'quality' input is set and the supplied version is in A.B.C syntax`, async () => {
129173
const inputVersion = '6.0.300';
130174
const inputQuality = 'ga' as QualityOptions;

0 commit comments

Comments
 (0)