Skip to content

Commit

Permalink
feat(23410): prettier fix
Browse files Browse the repository at this point in the history
Signed-off-by: ivan katliarchuk <[email protected]>
  • Loading branch information
ivankatliarchuk committed Dec 26, 2024
1 parent 339b63f commit 23c386b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
18 changes: 18 additions & 0 deletions lib/modules/datasource/aws-eks-addon/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ describe('modules/datasource/aws-eks-addon/index', () => {
});
});

it('with addon and profile', async () => {
mockDescribeAddonVersionsCommand({ addons: [] });
await getPkgReleases({
datasource,
packageName: '{"addonName":"vpc-cni-not-exist", "profile":"paradox"}',
});
expect(eksMock.calls()).toHaveLength(1);
});

it('with addon and region', async () => {
mockDescribeAddonVersionsCommand({ addons: [] });
await getPkgReleases({
datasource,
packageName: '{"addonName":"vpc-cni-not-exist", "region":"usa"}',
});
expect(eksMock.calls()).toHaveLength(1);
});

it('with addonName and default only config', async () => {
mockDescribeAddonVersionsCommand({ addons: [addonInfo] });
const res = await getPkgReleases({
Expand Down
22 changes: 12 additions & 10 deletions lib/modules/datasource/aws-eks-addon/schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import { EksAddonsFilter } from './schema';
describe('modules/datasource/aws-eks-addon/schema', () => {
describe('EksAddonsFilter', () => {
it.each`
input | expected
${{ kubernetesVersion: '1.30', addonName: 'kube_proxy' }} | ${false}
${{ kubernetesVersion: '130', addonName: 'kube_proxy' }} | ${false}
${{ addonName: 'kube_proxy', default: 'abrakadabra' }} | ${false}
${{ kubernetesVersion: '1.30' }} | ${false}
${{ addonName: 'kube-proxy', default: 'false' }} | ${true}
${{ addonName: 'kube-proxy', default: 'true' }} | ${true}
${{ addonName: 'kube-proxy', default: false }} | ${true}
${{ kubernetesVersion: '1.30', addonName: 'vpc-cni' }} | ${true}
${{ addonName: 'vpc-cni' }} | ${true}
input | expected
${{ kubernetesVersion: '1.30', addonName: 'kube_proxy' }} | ${false}
${{ kubernetesVersion: '130', addonName: 'kube_proxy' }} | ${false}
${{ addonName: 'kube_proxy', default: 'abrakadabra' }} | ${false}
${{ kubernetesVersion: '1.30' }} | ${false}
${{ addonName: 'kube-proxy', default: 'false' }} | ${true}
${{ addonName: 'kube-proxy', default: 'true' }} | ${true}
${{ addonName: 'kube-proxy', default: false }} | ${true}
${{ addonName: 'aws-cloudwatch-controller', default: false }} | ${true}
${{ addonName: 'aws-cloudwatch-controller', profile: 'abc' }} | ${true}
${{ kubernetesVersion: '1.30', addonName: 'vpc-cni' }} | ${true}
${{ addonName: 'vpc-cni' }} | ${true}
`('safeParse("$input") === $expected', ({ input, expected }) => {
const actual = EksAddonsFilter.safeParse(JSON.stringify(input));
expect(actual.success).toBe(expected);
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/versioning/aws-eks-addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class AwsEKSAddonVersioningApi extends GenericVersioningApi {
return null;
}
const [, prefix, suffix] = matches;
const release: number[] = prefix.split('.').map(Number);
if (release.length !== 3) {
if (!suffix) {
return null;
}
if (!suffix) {
const release: number[] = prefix.split('.').map(Number);
if (release.length !== 3) {
return null;

Check warning on line 33 in lib/modules/versioning/aws-eks-addon/index.ts

View check run for this annotation

Codecov / codecov/patch

lib/modules/versioning/aws-eks-addon/index.ts#L33

Added line #L33 was not covered by tests
}
return { release, suffix: suffix || '' };
return { release, suffix };
}

protected override _compare(version: string, other: string): number {
Expand Down

0 comments on commit 23c386b

Please sign in to comment.