refactor: Fix return type for filterInternalChecks function (#31259)

This commit is contained in:
Sergei Zharinov 2024-09-06 19:01:33 -03:00 committed by GitHub
parent 00a4cf733c
commit a91d646b2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View file

@ -61,7 +61,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0); 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 () => { it('returns non-pending latest release if internalChecksFilter=flexible and none pass checks', async () => {
@ -76,7 +76,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0); 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 () => { it('returns pending latest release if internalChecksFilter=strict and none pass checks', async () => {
@ -91,7 +91,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeTrue(); expect(res.pendingChecks).toBeTrue();
expect(res.pendingReleases).toHaveLength(0); 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 () => { it('returns non-latest release if internalChecksFilter=strict and some pass checks', async () => {
@ -106,7 +106,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(2); 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 () => { it('returns non-latest release if internalChecksFilter=flexible and some pass checks', async () => {
@ -121,7 +121,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(2); 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 () => { it('picks up minimumReleaseAge settings from hostRules', async () => {
@ -139,7 +139,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(0); 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 () => { it('picks up minimumReleaseAge settings from updateType', async () => {
@ -154,7 +154,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(1); 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 () => { it('picks up minimumConfidence settings from updateType', async () => {
@ -174,7 +174,7 @@ describe('workers/repository/process/lookup/filter-checks', () => {
expect(res).toMatchSnapshot(); expect(res).toMatchSnapshot();
expect(res.pendingChecks).toBeFalse(); expect(res.pendingChecks).toBeFalse();
expect(res.pendingReleases).toHaveLength(3); expect(res.pendingReleases).toHaveLength(3);
expect(res.release.version).toBe('1.0.1'); expect(res.release?.version).toBe('1.0.1');
}); });
}); });
}); });

View file

@ -16,7 +16,7 @@ import type { LookupUpdateConfig, UpdateResult } from './types';
import { getUpdateType } from './update-type'; import { getUpdateType } from './update-type';
export interface InternalChecksResult { export interface InternalChecksResult {
release: Release; release?: Release;
pendingChecks: boolean; pendingChecks: boolean;
pendingReleases?: Release[]; pendingReleases?: Release[];
} }
@ -117,6 +117,5 @@ export async function filterInternalChecks(
} }
} }
// TODO #22198 return { release, pendingChecks, pendingReleases };
return { release: release!, pendingChecks, pendingReleases };
} }