Skip to content

Commit

Permalink
fix(test): updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kavitha Kesavalu committed Nov 2, 2024
1 parent 58b1e64 commit b88ed7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/adapters/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ jest.mock('simple-git');
jest.mock('fs-extra');

class TestGitAdapter extends GitAdapter {
// @ts-ignore
createIssue(repo: IRepo): Promise<string> {
return Promise.resolve('');
}
// @ts-ignore
updateIssue(repo: IRepo, issueNumber: number): Promise<void> {
return Promise.resolve();
}
// @ts-ignore
getCandidateRepos(onRetry: RetryMethod): Promise<IRepo[]> {
return Promise.resolve([]);
Expand Down
8 changes: 5 additions & 3 deletions src/adapters/github.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,19 @@ describe('GithubAdapter', () => {

it('returns the SSH URL, when not given a protocol', () => {
delete process.env.SHEPHERD_GITHUB_PROTOCOL;
expect(adapter['getRepositoryUrl'](repo)).toBe('[email protected]:NerdWallet/shepherd.git');
expect(adapter['getRepositoryUrl'](repo)).toBe('git@api.github.com:NerdWallet/shepherd.git');
});

it('returns the SSH URL, when given protocol=ssh', () => {
process.env.SHEPHERD_GITHUB_PROTOCOL = 'ssh';
expect(adapter['getRepositoryUrl'](repo)).toBe('[email protected]:NerdWallet/shepherd.git');
expect(adapter['getRepositoryUrl'](repo)).toBe('git@api.github.com:NerdWallet/shepherd.git');
});

it('returns the HTTPS URL when given protocol=https', () => {
process.env.SHEPHERD_GITHUB_PROTOCOL = 'https';
expect(adapter['getRepositoryUrl'](repo)).toBe('https://github.com/NerdWallet/shepherd.git');
expect(adapter['getRepositoryUrl'](repo)).toBe(
'https://api.github.com/NerdWallet/shepherd.git'
);
});

it('throws on unexpected protocols', () => {
Expand Down

0 comments on commit b88ed7e

Please sign in to comment.