mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-05-11 03:59:54 +02:00
Merge 7618b1f401
into 85e6279cec
This commit is contained in:
commit
9748052ab2
10 changed files with 84 additions and 8 deletions
|
@ -813,6 +813,7 @@ async function setup(testName: string): Promise<void> {
|
|||
lfs: false,
|
||||
submodules: false,
|
||||
nestedSubmodules: false,
|
||||
submoduleDirectories: [],
|
||||
persistCredentials: true,
|
||||
ref: 'refs/heads/main',
|
||||
repositoryName: 'my-repo',
|
||||
|
|
|
@ -21,6 +21,13 @@ describe('input-helper tests', () => {
|
|||
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
|
||||
return inputs[name]
|
||||
})
|
||||
// Mock getMultilineInput
|
||||
jest.spyOn(core, 'getMultilineInput').mockImplementation((name: string) => {
|
||||
const input: string[] = (inputs[name] || '')
|
||||
.split('\n')
|
||||
.filter(x => x !== '')
|
||||
return input.map(inp => inp.trim())
|
||||
})
|
||||
|
||||
// Mock error/warning/info/debug
|
||||
jest.spyOn(core, 'error').mockImplementation(jest.fn())
|
||||
|
@ -87,6 +94,7 @@ describe('input-helper tests', () => {
|
|||
expect(settings.showProgress).toBe(true)
|
||||
expect(settings.lfs).toBe(false)
|
||||
expect(settings.ref).toBe('refs/heads/some-ref')
|
||||
expect(settings.submoduleDirectories).toStrictEqual([])
|
||||
expect(settings.repositoryName).toBe('some-repo')
|
||||
expect(settings.repositoryOwner).toBe('some-owner')
|
||||
expect(settings.repositoryPath).toBe(gitHubWorkspace)
|
||||
|
@ -144,4 +152,13 @@ describe('input-helper tests', () => {
|
|||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.workflowOrganizationId).toBe(123456)
|
||||
})
|
||||
it('sets submoduleDirectories', async () => {
|
||||
inputs['submodule-directories'] = 'submodule1\nsubmodule2'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.submoduleDirectories).toStrictEqual([
|
||||
'submodule1',
|
||||
'submodule2'
|
||||
])
|
||||
expect(settings.submodules).toBe(true)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue