Commit 9a438147 authored by Tatyana Kostromskaya's avatar Tatyana Kostromskaya
Browse files

.

parent 317b5f36
Loading
Loading
Loading
Loading
+4 −4
Changes for __test__/git-auth-helper.test.ts: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -169,8 +169,9 @@ describe('git-auth-helper tests', () => {

    // Mock fs.promises.readFile
    const realReadFile = fs.promises.readFile
    jest.spyOn(fs.promises, 'readFile').mockImplementation(
      async (file: any, options: any): Promise<Buffer> => {
    jest
      .spyOn(fs.promises, 'readFile')
      .mockImplementation(async (file: any, options: any): Promise<Buffer> => {
        const userKnownHostsPath = path.join(
          os.homedir(),
          '.ssh',
@@ -181,8 +182,7 @@ describe('git-auth-helper tests', () => {
        }

        return await realReadFile(file, options)
      }
    )
      })

    // Act
    const authHelper = gitAuthHelper.createAuthHelper(git, settings)
+2 −2
Changes for __test__/ref-helper.test.ts: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@ let git: IGitCommandManager

describe('ref-helper tests', () => {
  beforeEach(() => {
    git = ({} as unknown) as IGitCommandManager
    git = {} as unknown as IGitCommandManager
  })

  it('getCheckoutInfo requires git', async () => {
    const git = (null as unknown) as IGitCommandManager
    const git = null as unknown as IGitCommandManager
    try {
      await refHelper.getCheckoutInfo(git, 'refs/heads/my/branch', commit)
      throw new Error('Should not reach here')
+1 −1
Changes for __test__/retry-helper.test.ts: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ describe('retry-helper tests', () => {

  it('all attempts fail succeeds', async () => {
    let attempts = 0
    let error: Error = (null as unknown) as Error
    let error: Error = null as unknown as Error
    try {
      await retryHelper.execute(() => {
        throw new Error(`some error ${++attempts}`)
+9 −6
Changes for src/fs-helper.ts: 9 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -18,8 +18,9 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
    }

    throw new Error(
      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
        ?.message ?? error}`
      `Encountered an error when checking whether path '${path}' exists: ${
        (error as any)?.message ?? error
      }`
    )
  }

@@ -45,8 +46,9 @@ export function existsSync(path: string): boolean {
    }

    throw new Error(
      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
        ?.message ?? error}`
      `Encountered an error when checking whether path '${path}' exists: ${
        (error as any)?.message ?? error
      }`
    )
  }

@@ -67,8 +69,9 @@ export function fileExistsSync(path: string): boolean {
    }

    throw new Error(
      `Encountered an error when checking whether path '${path}' exists: ${(error as any)
        ?.message ?? error}`
      `Encountered an error when checking whether path '${path}' exists: ${
        (error as any)?.message ?? error
      }`
    )
  }

+1 −1
Changes for src/git-auth-helper.ts: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class GitAuthHelper {
    gitSourceSettings: IGitSourceSettings | undefined
  ) {
    this.git = gitCommandManager
    this.settings = gitSourceSettings || (({} as unknown) as IGitSourceSettings)
    this.settings = gitSourceSettings || ({} as unknown as IGitSourceSettings)

    // Token auth header
    const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl)
Loading