Clean up based on feedback

Signed-off-by: Andre Wanlin <awanlin@rapidrtc.com>
This commit is contained in:
Andre Wanlin
2021-11-03 08:11:36 -05:00
parent 920fcd7fad
commit 12d43328ea
3 changed files with 27 additions and 4 deletions
@@ -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,
@@ -241,4 +241,24 @@ describe('getBuildStateComponent', () => {
expect(getByText('Unknown')).toBeInTheDocument();
});
});
});
});
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('');
});
});
});
@@ -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 '';
}