Apply consistent naming

This commit is contained in:
Nikolai Laevskii 2023-05-24 16:59:05 +02:00
parent b7461a1b69
commit 5c7ae4f903
2 changed files with 13 additions and 13 deletions

View File

@ -298,7 +298,7 @@ describe('installer tests', () => {
}); });
describe('DotnetVersionResolver tests', () => { describe('DotnetVersionResolver tests', () => {
describe('createDotNetVersion() tests', () => { describe('createDotnetVersion() tests', () => {
each([ each([
'3.1', '3.1',
'3.x', '3.x',
@ -315,7 +315,7 @@ describe('installer tests', () => {
version version
); );
const versionObject = const versionObject =
await dotnetVersionResolver.createDotNetVersion(); await dotnetVersionResolver.createDotnetVersion();
expect(!!versionObject.value).toBe(true); expect(!!versionObject.value).toBe(true);
} }
@ -354,7 +354,7 @@ describe('installer tests', () => {
); );
await expect( await expect(
async () => await dotnetVersionResolver.createDotNetVersion() async () => await dotnetVersionResolver.createDotnetVersion()
).rejects.toThrow(); ).rejects.toThrow();
} }
); );
@ -366,7 +366,7 @@ describe('installer tests', () => {
version version
); );
const versionObject = const versionObject =
await dotnetVersionResolver.createDotNetVersion(); await dotnetVersionResolver.createDotnetVersion();
expect(versionObject.type.toLowerCase().includes('channel')).toBe( expect(versionObject.type.toLowerCase().includes('channel')).toBe(
true true
@ -381,7 +381,7 @@ describe('installer tests', () => {
version version
); );
const versionObject = const versionObject =
await dotnetVersionResolver.createDotNetVersion(); await dotnetVersionResolver.createDotnetVersion();
expect(versionObject.type.toLowerCase().includes('channel')).toBe( expect(versionObject.type.toLowerCase().includes('channel')).toBe(
true true
@ -397,7 +397,7 @@ describe('installer tests', () => {
version version
); );
const versionObject = const versionObject =
await dotnetVersionResolver.createDotNetVersion(); await dotnetVersionResolver.createDotnetVersion();
expect(versionObject.type.toLowerCase().includes('version')).toBe( expect(versionObject.type.toLowerCase().includes('version')).toBe(
true true
@ -413,7 +413,7 @@ describe('installer tests', () => {
version version
); );
const versionObject = const versionObject =
await dotnetVersionResolver.createDotNetVersion(); await dotnetVersionResolver.createDotnetVersion();
const windowsRegEx = new RegExp(/^-(Version|Channel)/); const windowsRegEx = new RegExp(/^-(Version|Channel)/);
const nonWindowsRegEx = new RegExp(/^--(version|channel)/); const nonWindowsRegEx = new RegExp(/^--(version|channel)/);
@ -433,7 +433,7 @@ describe('installer tests', () => {
version version
); );
await expect( await expect(
async () => await dotnetVersionResolver.createDotNetVersion() async () => await dotnetVersionResolver.createDotnetVersion()
).rejects.toThrow( ).rejects.toThrow(
`'dotnet-version' was supplied in invalid format: ${version}! The A.B.Cxx syntax is available since the .NET 5.0 release.` `'dotnet-version' was supplied in invalid format: ${version}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
); );

View File

@ -81,7 +81,7 @@ export class DotnetVersionResolver {
parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false; parseInt(major) >= QUALITY_INPUT_MINIMAL_MAJOR_TAG ? true : false;
} }
public async createDotNetVersion(): Promise<DotnetVersion> { public async createDotnetVersion(): Promise<DotnetVersion> {
await this.resolveVersionInput(); await this.resolveVersionInput();
if (!this.resolvedArgument.type) { if (!this.resolvedArgument.type) {
return this.resolvedArgument; return this.resolvedArgument;
@ -102,7 +102,7 @@ export class DotnetVersionResolver {
maxRetries: 3 maxRetries: 3
}); });
const response = await httpClient.getJson<any>( const response = await httpClient.getJson<any>(
DotnetVersionResolver.DotNetCoreIndexUrl DotnetVersionResolver.DotnetCoreIndexUrl
); );
const result = response.result || {}; const result = response.result || {};
const releasesInfo: any[] = result['releases-index']; const releasesInfo: any[] = result['releases-index'];
@ -114,14 +114,14 @@ export class DotnetVersionResolver {
if (!releaseInfo) { if (!releaseInfo) {
throw new Error( throw new Error(
`Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotNetCoreIndexUrl}` `Could not find info for version with major tag: "${majorTag}" at ${DotnetVersionResolver.DotnetCoreIndexUrl}`
); );
} }
return releaseInfo['channel-version']; return releaseInfo['channel-version'];
} }
static DotNetCoreIndexUrl = static DotnetCoreIndexUrl =
'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json'; 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
} }
@ -256,7 +256,7 @@ export class DotnetCoreInstaller {
public async installDotnet(): Promise<string | null> { public async installDotnet(): Promise<string | null> {
const versionResolver = new DotnetVersionResolver(this.version); const versionResolver = new DotnetVersionResolver(this.version);
const dotnetVersion = await versionResolver.createDotNetVersion(); const dotnetVersion = await versionResolver.createDotnetVersion();
const installScript = new DotnetInstallScript() const installScript = new DotnetInstallScript()
.useArguments( .useArguments(