properly getting CR URL

This commit is contained in:
Edwin Sirko
2024-01-26 13:03:16 -05:00
parent 002cf60682
commit 5f9b214e33
5 changed files with 68 additions and 23 deletions
+28
View File
@@ -1,5 +1,6 @@
import * as fsHelper from '../src/fs-helper'
import * as fs from 'fs'
import * as path from 'path'
import * as os from 'os'
import { execSync } from 'child_process'
@@ -131,6 +132,33 @@ describe('isDirectory', () => {
})
})
describe('isActionRepo', () => {
let stagingDir: string
beforeEach(() => {
stagingDir = fsHelper.createTempDir()
})
afterEach(() => {
fs.rmSync(stagingDir, { recursive: true })
})
it('returns true if action.yml exists at the root', () => {
fs.writeFileSync(path.join(stagingDir, `action.yml`), fileContent)
expect(fsHelper.isActionRepo(stagingDir)).toEqual(true)
})
it('returns true if action.yaml exists at the root', () => {
fs.writeFileSync(path.join(stagingDir, `action.yaml`), fileContent)
expect(fsHelper.isActionRepo(stagingDir)).toEqual(true)
})
it("returns false if action.y(a)ml doesn't exist at the root", () => {
fs.writeFileSync(path.join(stagingDir, `action.yaaml`), fileContent)
expect(fsHelper.isActionRepo(stagingDir)).toEqual(false)
})
})
describe('readFileContents', () => {
let dir: string