0
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-10-23 09:51:56 +03:00

change: remove path.sep, add unit tests, dist

Remove path.sep during comparison with repositoryPath
(did not take in account root folders)
Updated and added more unit tests
Updated dist/index.js
This commit is contained in:
Marco Accorinti 2023-09-20 21:02:10 +02:00
parent faa95350fe
commit 53a4183dea
4 changed files with 26 additions and 6 deletions

View file

@ -143,4 +143,25 @@ describe('input-helper tests', () => {
const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.workflowOrganizationId).toBe(123456)
})
it('sets a different working directory', async() => {
inputs['working-directory'] = '/home/user/test'
inputs['path'] = 'path/to/repo'
const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.repositoryPath).toBe(path.resolve('/home/user/test/path/to/repo'))
})
it('sets a working directory on root', async() => {
inputs['working-directory'] = '/'
inputs['path'] = 'path/to/repo'
const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.repositoryPath).toBe(path.resolve('/path/to/repo'))
})
it('sets a working directory on root and repository path is set to empty', async() => {
inputs['working-directory'] = '/'
inputs['path'] = ''
const settings: IGitSourceSettings = await inputHelper.getInputs()
expect(settings.repositoryPath).toBe(path.resolve('/'))
})
})