From 83a1653fa32f4cf123fe3aec2962ff47ffd65859 Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Thu, 18 May 2023 11:46:40 +0200 Subject: [PATCH] Update regular expresiion for isLatestPatchSyntax() --- __tests__/installer.test.ts | 21 ++------------------- dist/index.js | 2 +- src/installer.ts | 2 +- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 08aa8e7..808d34a 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -359,16 +359,7 @@ describe('installer tests', () => { } ); - each([ - '3', - '3.1', - '3.1.x', - '3.1.*', - '3.1.X', - '6.0.2xx', - '6.0.2XX', - '6.0.2**' - ]).test( + each(['3', '3.1', '3.1.x', '3.1.*', '3.1.X', '6.0.2xx']).test( "if version that can be resolved to 'channel' option is supplied (%s), it should set type to 'channel' in version object", async version => { const dotnetVersionResolver = new installer.DotnetVersionResolver( @@ -383,15 +374,7 @@ describe('installer tests', () => { } ); - each([ - '6.0', - '6.0.x', - '6.0.*', - '6.0.X', - '6.0.2xx', - '6.0.2XX', - '6.0.2**' - ]).test( + each(['6.0', '6.0.x', '6.0.*', '6.0.X', '6.0.2xx']).test( "if version that can be resolved to 'channel' option is supplied and its major tag is >= 6 (%s), it should set type to 'channel' and qualityFlag to 'true' in version object", async version => { const dotnetVersionResolver = new installer.DotnetVersionResolver( diff --git a/dist/index.js b/dist/index.js index aca3dd0..093671e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -270,7 +270,7 @@ class DotnetVersionResolver { } isLatestPatchSyntax() { var _b, _c; - const majorTag = (_c = (_b = this.inputVersion.match(/^(?\d+)\.\d+\.\d{1}(x|X|\*){2}$/)) === null || _b === void 0 ? void 0 : _b.groups) === null || _c === void 0 ? void 0 : _c.majorTag; + const majorTag = (_c = (_b = this.inputVersion.match(/^(?\d+)\.\d+\.\d{1}x{2}$/)) === null || _b === void 0 ? void 0 : _b.groups) === null || _c === void 0 ? void 0 : _c.majorTag; if (majorTag && parseInt(majorTag) < DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag) { diff --git a/src/installer.ts b/src/installer.ts index e4c3ffe..d31ec00 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -49,7 +49,7 @@ export class DotnetVersionResolver { private isLatestPatchSyntax() { const majorTag = this.inputVersion.match( - /^(?\d+)\.\d+\.\d{1}(x|X|\*){2}$/ + /^(?\d+)\.\d+\.\d{1}x{2}$/ )?.groups?.majorTag; if ( majorTag &&