Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh committed Oct 28, 2022
1 parent bd8f1ad commit 816de12
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
44 changes: 20 additions & 24 deletions lib/workers/repository/finalise/repository-statistics.spec.ts
Expand Up @@ -87,12 +87,11 @@ describe('workers/repository/finalise/repository-statistics', () => {

it('processes cache with baseBranches and branches', () => {
const sha = '793221454914cdc422e1a8f0ca27b96fe39ff9ad';
const parentSha = '793221454914cdc422e1a8f0ca27b96fe39ff9ad';
const baseBranchSha = '793221454914cdc422e1a8f0ca27b96fe39ff9ad';
const baseBranch = 'base-branch';
const baseCache = partial<BaseBranchCache>({ sha });
const branchCache = partial<BranchCache>({
sha,
parentSha,
baseBranch,
isModified: false,
automerge: false,
Expand All @@ -101,7 +100,7 @@ describe('workers/repository/finalise/repository-statistics', () => {
automerge: branchCache.automerge,
isModified: branchCache.isModified,
baseBranch,
baseBranchSha: parentSha,
baseBranchSha,
branchSha: sha,
};
const branches: BranchCache[] = [
Expand All @@ -120,27 +119,24 @@ describe('workers/repository/finalise/repository-statistics', () => {
getCacheSpy.mockReturnValueOnce(cache);
isCacheModifiedSpy.mockReturnValueOnce(false);
runBranchSummary();
expect(logger.debug).toHaveBeenCalledWith(
{
cacheModified: false,
baseBranches: [
{
branchName: 'main',
sha,
},
{
branchName: 'dev',
sha,
},
],
branches: [
{ ...expectedMeta, branchName: 'b1' },
{ ...expectedMeta, branchName: 'b2' },
],
inactiveBranches: ['b3'],
},
`Branch summary`
);
expect(logger.debug).toHaveBeenCalledWith({
cacheModified: false,
baseBranches: [
{
branchName: 'main',
sha,
},
{
branchName: 'dev',
sha,
},
],
branches: [
{ ...expectedMeta, branchName: 'b1' },
{ ...expectedMeta, branchName: 'b2' },
],
inactiveBranches: ['b3'],
});
});
});
});
2 changes: 1 addition & 1 deletion lib/workers/repository/finalise/repository-statistics.ts
Expand Up @@ -45,7 +45,7 @@ function branchCacheToMetadata({
branchName,
sha: branchSha,
baseBranch,
parentSha: baseBranchSha,
baseBranchSha,
automerge,
isModified,
}: BranchCache): BranchMetadata {
Expand Down
8 changes: 4 additions & 4 deletions lib/workers/types.ts
Expand Up @@ -133,10 +133,10 @@ export interface BranchConfig
export interface BranchMetadata {
branchName: string;
branchSha: string | null;
baseBranch: string | undefined;
baseBranchSha: string | null | undefined;
baseBranch?: string;
baseBranchSha?: string | null;
automerge: boolean;
isModified: boolean | undefined;
isModified?: boolean;
}

export interface BaseBranchMetadata {
Expand All @@ -145,7 +145,7 @@ export interface BaseBranchMetadata {
}

export interface BranchSummary {
cacheModified: boolean | undefined;
cacheModified?: boolean;
baseBranches: BaseBranchMetadata[];
branches: BranchMetadata[];
inactiveBranches: string[];
Expand Down

0 comments on commit 816de12

Please sign in to comment.