message: chore: removing dependency for githubn preparer
diff: * limitations under the License.
  */
  -const mocks = {
  - Clone: { clone: jest.fn() },
  - CheckoutOptions: jest.fn(() => {}),
  -};
  -jest.doMock('nodegit', () => mocks);
  jest.doMock('fs-extra', () => ({
  promises: {
  mkdtemp: jest.fn(dir => `${dir}-static`),
  @@ -30,10 +25,16 @@ import {
  TemplateEntityV1alpha1,
  LOCATION_ANNOTATION,
  } from '@backstage/catalog-model';
  -import { getVoidLogger } from '@backstage/backend-common';
  +import { getVoidLogger, Git } from '@backstage/backend-common';
  describe('GitHubPreparer', () => {
  let mockEntity: TemplateEntityV1alpha1;
  + const mockGitClient = {
  + clone: jest.fn(),
  + };
  +
  + jest.spyOn(Git, 'fromAuth').mockReturnValue(mockGitClient as any);
  +
  beforeEach(() => {
  jest.clearAllMocks();
  mockEntity = {
  @@ -77,28 +78,24 @@ describe('GitHubPreparer', () => {
  });
  it('calls the clone command with the correct arguments for a repository', async () => {
  const preparer = new GithubPreparer();
  +
  await preparer.prepare(mockEntity, { logger: getVoidLogger() });
  - expect(mocks.Clone.clone).toHaveBeenNthCalledWith(
  - 1,
  - 'https://github.com/benjdlambert/backstage-graphql-template',
  - expect.any(String),
  - {
  - checkoutBranch: 'master',
  - },
  - );
  +
  + expect(mockGitClient.clone).toHaveBeenCalledWith({
  + url: 'https://github.com/benjdlambert/backstage-graphql-template',
  + dir: expect.any(String),
  + });
  });
  it('calls the clone command with the correct arguments for a repository when no path is provided', async () => {
  const preparer = new GithubPreparer();
  delete mockEntity.spec.path;
  +
  await preparer.prepare(mockEntity, { logger: getVoidLogger() });
  - expect(mocks.Clone.clone).toHaveBeenNthCalledWith(
  - 1,
  - 'https://github.com/benjdlambert/backstage-graphql-template',
  - expect.any(String),
  - {
  - checkoutBranch: 'master',
  - },
  - );
  +
  + expect(mockGitClient.clone).toHaveBeenCalledWith({
  + url: 'https://github.com/benjdlambert/backstage-graphql-template',
  + dir: expect.any(String),
  + });
  });
  it('return the temp directory with the path to the folder if it is specified', async () => {
  @@ -128,19 +125,14 @@ describe('GitHubPreparer', () => {
  it('calls the clone command with the token when provided', async () => {
  const preparer = new GithubPreparer({ token: 'abc' });
  - await preparer.prepare(mockEntity, { logger: getVoidLogger() });
  - expect(mocks.Clone.clone).toHaveBeenNthCalledWith(
  - 1,
  - 'https://github.com/benjdlambert/backstage-graphql-template',
  - expect.any(String),
  - {
  - checkoutBranch: 'master',
  - fetchOpts: {
  - callbacks: {
  - credentials: expect.any(Function),
  - },
  - },
  - },
  - );
  + const logger = getVoidLogger();
  +
  + await preparer.prepare(mockEntity, { logger });
  +
  + expect(Git.fromAuth).toHaveBeenCalledWith({
  + logger,
  + username: 'abc',
  + password: 'x-oauth-basic',
  + });
  });
  });
  