Skip to content

Commit

Permalink
refactor: Fix return type for filterInternalChecks function (#31259)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov authored Sep 6, 2024
1 parent 00a4cf7 commit a91d646
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
16 changes: 8 additions & 8 deletions lib/workers/repository/process/lookup/filter-checks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0);
expect(res.release.version).toBe('1.0.4');
expect(res.release?.version).toBe('1.0.4');
});

it('returns non-pending latest release if internalChecksFilter=flexible and none pass checks', async () => {
Expand All @@ -76,7 +76,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0);
expect(res.release.version).toBe('1.0.4');
expect(res.release?.version).toBe('1.0.4');
});

it('returns pending latest release if internalChecksFilter=strict and none pass checks', async () => {
Expand All @@ -91,7 +91,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeTrue();
expect(res.pendingReleases).toHaveLength(0);
expect(res.release.version).toBe('1.0.4');
expect(res.release?.version).toBe('1.0.4');
});

it('returns non-latest release if internalChecksFilter=strict and some pass checks', async () => {
Expand All @@ -106,7 +106,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(2);
expect(res.release.version).toBe('1.0.2');
expect(res.release?.version).toBe('1.0.2');
});

it('returns non-latest release if internalChecksFilter=flexible and some pass checks', async () => {
Expand All @@ -121,7 +121,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(2);
expect(res.release.version).toBe('1.0.2');
expect(res.release?.version).toBe('1.0.2');
});

it('picks up minimumReleaseAge settings from hostRules', async () => {
Expand All @@ -139,7 +139,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0);
expect(res.release.version).toBe('1.0.4');
expect(res.release?.version).toBe('1.0.4');
});

it('picks up minimumReleaseAge settings from updateType', async () => {
Expand All @@ -154,7 +154,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(1);
expect(res.release.version).toBe('1.0.3');
expect(res.release?.version).toBe('1.0.3');
});

it('picks up minimumConfidence settings from updateType', async () => {
Expand All @@ -174,7 +174,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(3);
expect(res.release.version).toBe('1.0.1');
expect(res.release?.version).toBe('1.0.1');
});
});
});
5 changes: 2 additions & 3 deletions lib/workers/repository/process/lookup/filter-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { LookupUpdateConfig, UpdateResult } from './types';
import { getUpdateType } from './update-type';

export interface InternalChecksResult {
release: Release;
release?: Release;
pendingChecks: boolean;
pendingReleases?: Release[];
}
Expand Down Expand Up @@ -117,6 +117,5 @@ export async function filterInternalChecks(
}
}

// TODO #22198
return { release: release!, pendingChecks, pendingReleases };
return { release, pendingChecks, pendingReleases };
}

0 comments on commit a91d646

Please sign in to comment.