diff --git a/plugins/azure-devops/src/api/AzureDevOpsClient.ts b/plugins/azure-devops/src/api/AzureDevOpsClient.ts index 7e566e458f..ec727f4973 100644 --- a/plugins/azure-devops/src/api/AzureDevOpsClient.ts +++ b/plugins/azure-devops/src/api/AzureDevOpsClient.ts @@ -37,7 +37,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi { this.identityApi = options.identityApi; } - async getRepoBuilds( + public async getRepoBuilds( projectName: string, repoName: string, options?: RepoBuildOptions, @@ -48,7 +48,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi { return { items }; } - async getPullRequests( + public async getPullRequests( projectName: string, repoName: string, options?: PullRequestOptions, diff --git a/plugins/azure-devops/src/components/BuildTable/BuildTable.test.ts b/plugins/azure-devops/src/components/BuildTable/BuildTable.test.ts index 7f7d72b027..3797cb65d6 100644 --- a/plugins/azure-devops/src/components/BuildTable/BuildTable.test.ts +++ b/plugins/azure-devops/src/components/BuildTable/BuildTable.test.ts @@ -241,4 +241,24 @@ describe('getBuildStateComponent', () => { expect(getByText('Unknown')).toBeInTheDocument(); }); }); -}); \ No newline at end of file +}); + +describe('getBuildDuration', () => { + describe('getBuildDuration with undefined startTime and valid finishTime', () => { + it('should return empty result', () => { + const finishTime = new Date('2021-10-15T11:00:00.0000000Z'); + + const result = getBuildDuration(undefined, finishTime); + + expect(result).toEqual(''); + }); + }); + + describe('getBuildDuration with undefined startTime and undefined finishTime', () => { + it('should return empty result', () => { + const result = getBuildDuration(undefined, undefined); + + expect(result).toEqual(''); + }); + }); +}); diff --git a/plugins/azure-devops/src/components/BuildTable/BuildTable.tsx b/plugins/azure-devops/src/components/BuildTable/BuildTable.tsx index 27602f9345..6166c81aa6 100644 --- a/plugins/azure-devops/src/components/BuildTable/BuildTable.tsx +++ b/plugins/azure-devops/src/components/BuildTable/BuildTable.tsx @@ -115,7 +115,10 @@ export const getBuildStateComponent = ( } }; -export const getBuildDuration = (startTime?: Date, finishTime?: Date) => { +export const getBuildDuration = ( + startTime?: Date, + finishTime?: Date, +): string => { if (!startTime || (!startTime && !finishTime)) { return ''; }