Skip to content

Commit ba318a1

Browse files
committed
.
1 parent eb22d79 commit ba318a1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

__test__/git-auth-helper.test.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import * as core from '@actions/core'
22
import * as fs from 'fs'
33
import * as gitAuthHelper from '../lib/git-auth-helper'
44
import * as io from '@actions/io'
5+
import * as os from 'os'
56
import * as path from 'path'
67
import {IGitCommandManager} from '../lib/git-command-manager'
78
import {IGitSourceSettings} from '../lib/git-source-settings'
89

10+
const isWindows = process.platform === 'win32'
911
const testWorkspace = path.join(__dirname, '_temp', 'git-auth-helper')
1012
const originalRunnerTemp = process.env['RUNNER_TEMP']
1113
const originalHome = process.env['HOME']
@@ -22,7 +24,7 @@ describe('git-auth-helper tests', () => {
2224
beforeAll(async () => {
2325
// SSH
2426
sshPath = await io.which('ssh')
25-
27+
2628
// Clear test workspace
2729
await io.rmRF(testWorkspace)
2830
})
@@ -112,7 +114,8 @@ describe('git-auth-helper tests', () => {
112114
}
113115
)
114116

115-
const configureAuth_copiesUserKnownHosts = 'configureAuth copies user known hosts'
117+
const configureAuth_copiesUserKnownHosts =
118+
'configureAuth copies user known hosts'
116119
it(configureAuth_copiesUserKnownHosts, async () => {
117120
if (!sshPath) {
118121
process.stdout.write(
@@ -210,7 +213,7 @@ describe('git-auth-helper tests', () => {
210213
)
211214

212215
// Asserty git config
213-
const gitConfigLines = (await fs.promises.readFile(gitConfigPath))
216+
const gitConfigLines = (await fs.promises.readFile(localGitConfigPath))
214217
.toString()
215218
.split('\n')
216219
.filter(x => x)
@@ -462,7 +465,7 @@ describe('git-auth-helper tests', () => {
462465
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
463466
await authHelper.configureAuth()
464467
let gitConfigContent = (
465-
await fs.promises.readFile(gitConfigPath)
468+
await fs.promises.readFile(localGitConfigPath)
466469
).toString()
467470
expect(gitConfigContent.indexOf('core.sshCommand')).toBeGreaterThanOrEqual(
468471
0
@@ -478,7 +481,7 @@ describe('git-auth-helper tests', () => {
478481
await authHelper.removeAuth()
479482

480483
// Assert git config
481-
gitConfigContent = (await fs.promises.readFile(gitConfigPath)).toString()
484+
gitConfigContent = (await fs.promises.readFile(localGitConfigPath)).toString()
482485
expect(gitConfigContent.indexOf('core.sshCommand')).toBeLessThan(0)
483486

484487
// Assert SSH key file
@@ -681,4 +684,4 @@ async function getActualSshKnownHostsPath(): Promise<string> {
681684
expect(actualTempFiles[1].endsWith('_known_hosts')).toBeTruthy()
682685
expect(actualTempFiles[1].startsWith(actualTempFiles[0])).toBeTruthy()
683686
return actualTempFiles[1]
684-
}
687+
}

0 commit comments

Comments
 (0)