From f954d861d4105c0cc1fa87c62f90a830aad220d0 Mon Sep 17 00:00:00 2001 From: askalf <263217947+askalf@users.noreply.github.com> Date: Tue, 15 Sep 2026 06:59:42 +0000 Subject: [PATCH] add a test for a non-SHA ref on the REST API fallback path --- __test__/git-source-provider.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/__test__/git-source-provider.test.ts b/__test__/git-source-provider.test.ts index 44cd1bb..114b6dc 100644 --- a/__test__/git-source-provider.test.ts +++ b/__test__/git-source-provider.test.ts @@ -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()