mirror of
https://github.com/actions/checkout.git
synced 2026-09-16 12:53:06 +00:00
add a test for a non-SHA ref on the REST API fallback path
This commit is contained in:
parent
7282dbb854
commit
f954d861d4
@ -173,6 +173,23 @@ describe('git-source-provider tests', () => {
|
||||
expect(mockSetOutput).toHaveBeenCalledWith('commit', '')
|
||||
})
|
||||
|
||||
it('sets an empty commit output when downloading a ref that is not a SHA', async () => {
|
||||
// Arrange
|
||||
mockCreateCommandManager.mockImplementation(async () => {
|
||||
throw new Error('Git is not installed')
|
||||
})
|
||||
const settings = getSettings()
|
||||
// getInputs() leaves commit undefined when a non-SHA ref is given for another repository
|
||||
settings.commit = undefined as unknown as string
|
||||
|
||||
// Act
|
||||
await gitSourceProvider.getSource(settings)
|
||||
|
||||
// Assert
|
||||
expect(mockDownloadRepository).toHaveBeenCalled()
|
||||
expect(mockSetOutput).toHaveBeenCalledWith('commit', undefined)
|
||||
})
|
||||
|
||||
it('sets the commit output from git when git is available (control)', async () => {
|
||||
// Arrange
|
||||
const git = getGitCommandManager()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user