Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace as with partial #20511

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface RenovateSharedConfig {
branchPrefixOld?: string;
branchName?: string;
branchNameStrict?: boolean;
manager?: string | null;
manager?: string;
commitMessage?: string;
commitMessagePrefix?: string;
confidential?: boolean;
Expand Down Expand Up @@ -454,7 +454,7 @@ export interface PackageRuleInputConfig extends Record<string, unknown> {
sourceUrl?: string | null;
language?: string;
baseBranch?: string;
manager?: string | null;
manager?: string;
datasource?: string;
packageRules?: (PackageRule & PackageRuleInputConfig)[];
}
Expand Down
16 changes: 10 additions & 6 deletions lib/modules/manager/gomod/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1083,9 +1083,11 @@ describe('modules/manager/gomod/artifacts', () => {
fs.readLocalFile.mockResolvedValueOnce('Current go.sum');
fs.readLocalFile.mockResolvedValueOnce(null); // vendor modules filename
const execSnapshots = mockExecAll();
git.getRepoStatus.mockResolvedValueOnce({
modified: ['go.sum'],
} as StatusResult);
git.getRepoStatus.mockResolvedValueOnce(
partial<StatusResult>({
modified: ['go.sum'],
})
);
fs.readLocalFile.mockResolvedValueOnce('New go.sum 1');
fs.readLocalFile.mockResolvedValueOnce('New go.sum 2');
fs.readLocalFile.mockResolvedValueOnce('New go.sum 3');
Expand Down Expand Up @@ -1146,9 +1148,11 @@ describe('modules/manager/gomod/artifacts', () => {
fs.readLocalFile.mockResolvedValueOnce('Current go.sum');
fs.readLocalFile.mockResolvedValueOnce(null); // vendor modules filename
const execSnapshots = mockExecAll();
git.getRepoStatus.mockResolvedValueOnce({
modified: ['go.sum'],
} as StatusResult);
git.getRepoStatus.mockResolvedValueOnce(
partial<StatusResult>({
modified: ['go.sum'],
})
);
fs.readLocalFile.mockResolvedValueOnce('New go.sum 1');
fs.readLocalFile.mockResolvedValueOnce('New go.sum 2');
fs.readLocalFile.mockResolvedValueOnce('New go.sum 3');
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface RangeConfig<T = Record<string, any>> extends ManagerData<T> {
currentValue?: string;
depName?: string;
depType?: string;
manager?: string | null;
manager?: string;
rangeStrategy: RangeStrategy;
}

Expand Down
54 changes: 32 additions & 22 deletions lib/workers/repository/update/branch/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1627,11 +1627,13 @@ describe('workers/repository/update/branch/index', () => {
path: 'pom.xml',
contents: 'pom.xml file contents',
};
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce({
updatedPackageFiles: [updatedPackageFile],
artifactErrors: [],
updatedArtifacts: [],
} as PackageFilesResult);
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce(
partial<PackageFilesResult>({
updatedPackageFiles: [updatedPackageFile],
artifactErrors: [],
updatedArtifacts: [],
})
);
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
artifactErrors: [],
updatedArtifacts: [
Expand Down Expand Up @@ -1784,11 +1786,13 @@ describe('workers/repository/update/branch/index', () => {
path: 'pom.xml',
contents: 'pom.xml file contents',
};
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce({
updatedPackageFiles: [updatedPackageFile],
artifactErrors: [],
updatedArtifacts: [],
} as PackageFilesResult);
getUpdated.getUpdatedPackageFiles.mockResolvedValueOnce(
partial<PackageFilesResult>({
updatedPackageFiles: [updatedPackageFile],
artifactErrors: [],
updatedArtifacts: [],
})
);
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
artifactErrors: [],
updatedArtifacts: [
Expand Down Expand Up @@ -2014,10 +2018,12 @@ describe('workers/repository/update/branch/index', () => {
});

it('Dependency Dashboard All Pending approval', async () => {
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
} as PackageFilesResult);
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce(
partial<PackageFilesResult>({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
})
);
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
artifactErrors: [],
updatedArtifacts: [partial<FileChange>({})],
Expand Down Expand Up @@ -2049,10 +2055,12 @@ describe('workers/repository/update/branch/index', () => {
});

it('Dependency Dashboard open all rate-limited', async () => {
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
} as PackageFilesResult);
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce(
partial<PackageFilesResult>({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
})
);
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
artifactErrors: [],
updatedArtifacts: [partial<FileChange>({})],
Expand Down Expand Up @@ -2084,10 +2092,12 @@ describe('workers/repository/update/branch/index', () => {
});

it('continues branch, skips automerge if there are artifact errors', async () => {
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
} as PackageFilesResult);
jest.spyOn(getUpdated, 'getUpdatedPackageFiles').mockResolvedValueOnce(
partial<PackageFilesResult>({
updatedPackageFiles: [partial<FileChange>({})],
artifactErrors: [{}],
})
);
npmPostExtract.getAdditionalFiles.mockResolvedValueOnce({
artifactErrors: [],
updatedArtifacts: [],
Expand Down
Loading