properly getting CR URL
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user