Skip to content

Commit 411841a

Browse files
krishagarwal278openshift-cherrypick-robot
authored andcommitted
Fixed test failures
1 parent b7d12d1 commit 411841a

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

frontend/packages/git-service/src/services/__tests__/github-service.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,55 +340,55 @@ describe('Github Service', () => {
340340
it('should use HTTPS protocol for standard GitHub URL', () => {
341341
const gitSource: GitSource = { url: 'https://github.com/owner/repo' };
342342
const gitService = new GithubService(gitSource);
343-
const { metadata } = gitService;
343+
const metadata = gitService.getRepoMetadata();
344344

345345
expect(metadata.host).toBe('https://github.com');
346346
});
347347

348348
it('should preserve HTTP protocol', () => {
349349
const gitSource: GitSource = { url: 'http://github.example.com/owner/repo' };
350350
const gitService = new GithubService(gitSource);
351-
const { metadata } = gitService;
351+
const metadata = gitService.getRepoMetadata();
352352

353353
expect(metadata.host).toBe('http://github.example.com');
354354
});
355355

356356
it('should preserve custom port with HTTPS', () => {
357357
const gitSource: GitSource = { url: 'https://github.example.com:8443/owner/repo' };
358358
const gitService = new GithubService(gitSource);
359-
const { metadata } = gitService;
359+
const metadata = gitService.getRepoMetadata();
360360

361361
expect(metadata.host).toBe('https://github.example.com:8443');
362362
});
363363

364364
it('should preserve custom port with HTTP', () => {
365365
const gitSource: GitSource = { url: 'http://github.example.com:8080/owner/repo' };
366366
const gitService = new GithubService(gitSource);
367-
const { metadata } = gitService;
367+
const metadata = gitService.getRepoMetadata();
368368

369369
expect(metadata.host).toBe('http://github.example.com:8080');
370370
});
371371

372372
it('should default to HTTPS for SSH URLs and preserve port', () => {
373373
const gitSource: GitSource = { url: 'git@github.example.com:2222/owner/repo.git' };
374374
const gitService = new GithubService(gitSource);
375-
const { metadata } = gitService;
375+
const metadata = gitService.getRepoMetadata();
376376

377377
expect(metadata.host).toBe('https://github.example.com:2222');
378378
});
379379

380380
it('should default to HTTPS for git:// protocol URLs', () => {
381381
const gitSource: GitSource = { url: 'git://github.example.com/owner/repo.git' };
382382
const gitService = new GithubService(gitSource);
383-
const { metadata } = gitService;
383+
const metadata = gitService.getRepoMetadata();
384384

385385
expect(metadata.host).toBe('https://github.example.com');
386386
});
387387

388388
it('should preserve non-standard port regardless of original protocol', () => {
389389
const gitSource: GitSource = { url: 'ssh://git@github.example.com:9999/owner/repo.git' };
390390
const gitService = new GithubService(gitSource);
391-
const { metadata } = gitService;
391+
const metadata = gitService.getRepoMetadata();
392392

393393
expect(metadata.host).toBe('https://github.example.com:9999');
394394
});

frontend/packages/git-service/src/services/github-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class GithubService extends BaseService {
6161
}
6262
};
6363

64-
protected getRepoMetadata = (): RepoMetadata => {
64+
getRepoMetadata = (): RepoMetadata => {
6565
const { name, owner, protocols, port, resource } = GitUrlParse(this.gitsource.url);
6666
const rawProtocol = protocols?.[0];
6767
const isHttpProtocol = rawProtocol === 'http' || rawProtocol === 'https';

0 commit comments

Comments
 (0)