Skip to content

Commit

Permalink
fix: outdated sdk version handles non semver versions (#6586)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Mar 15, 2024
1 parent d5bc358 commit 06e2c6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/features/metrics/instance/findOutdatedSdks.test.ts
Expand Up @@ -52,7 +52,13 @@ describe('findOutdatedSDKs', () => {
});

it('should ignore invalid SDK versions', () => {
const sdkVersions = ['unleash-client-node', '1.2.3', null];
const sdkVersions = [
'unleash-client-node',
'1.2.3',
'unleash-client-node:0.0',
'unleash-client-node:development',
null,
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([]);
});
Expand Down
1 change: 1 addition & 0 deletions src/lib/features/metrics/instance/findOutdatedSdks.ts
Expand Up @@ -21,6 +21,7 @@ export const isOutdatedSdk = (sdkVersion: string | null) => {
const [sdkName, version] = result;
const minVersion = config[sdkName];
if (!minVersion) return false;
if (!semver.valid(version)) return false;
if (semver.lt(version, minVersion)) return true;
return false;
};
Expand Down

0 comments on commit 06e2c6e

Please sign in to comment.