-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflow-file): expose a function to check for existence of a wo…
…rkflow file
- Loading branch information
Showing
6 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {fileExists} from '@form8ion/core'; | ||
|
||
export default function ({projectRoot, name}) { | ||
return fileExists(`${projectRoot}/.github/workflows/${name}.yml`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {fileExists} from '@form8ion/core'; | ||
|
||
import {when} from 'jest-when'; | ||
import any from '@travi/any'; | ||
import {describe, expect, it, vi} from 'vitest'; | ||
|
||
import workflowFileExists from './existence-checker.js'; | ||
|
||
vi.mock('@form8ion/core'); | ||
|
||
describe('workflow existence checker', () => { | ||
it('should check for existence of the workflow file in the workflows directory', async () => { | ||
const projectRoot = any.string(); | ||
const name = any.word(); | ||
const exists = any.boolean(); | ||
when(fileExists).calledWith(`${projectRoot}/.github/workflows/${name}.yml`).mockResolvedValue(exists); | ||
|
||
expect(await workflowFileExists({projectRoot, name})).toBe(exists); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {default as fileExists} from './existence-checker.js'; | ||
export {default as load} from './loader.js'; | ||
export {default as write} from './writer.js'; |