Skip to content

Commit

Permalink
fix: conditionally set values
Browse files Browse the repository at this point in the history
  • Loading branch information
j-zimnowoda committed Feb 7, 2025
1 parent 11de875 commit 3a24ad8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/common/repo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { pathExists } from 'fs-extra'
import { rm, writeFile } from 'fs/promises'
import { globSync } from 'glob'
import jsonpath from 'jsonpath'
Expand Down Expand Up @@ -288,10 +289,11 @@ export const saveResourceGroupToFiles = async (
)
}

export const setValuesFile = async (envDir: string): Promise<string> => {
const allValues = await loadValues(envDir)
export const setValuesFile = async (envDir: string, deps = { pathExists, loadValues, writeFile }): Promise<string> => {

Check warning on line 292 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch

Check warning on line 292 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
const valuesPath = path.join(envDir, 'values-repo.yaml')
await writeFile(valuesPath, objectToYaml(allValues))
if (await deps.pathExists(valuesPath)) return valuesPath

Check warning on line 294 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 294 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 294 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
const allValues = await deps.loadValues(envDir)

Check warning on line 295 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
await deps.writeFile(valuesPath, objectToYaml(allValues))

Check warning on line 296 in src/common/repo.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
return valuesPath
}

Expand Down

0 comments on commit 3a24ad8

Please sign in to comment.