mirror of
https://code.forgejo.org/actions/upload-artifact.git
synced 2025-05-25 02:14:45 +00:00
Support for multi path upload
This commit is contained in:
parent
4347a0d55a
commit
5db5708164
4 changed files with 231 additions and 11 deletions
|
@ -286,4 +286,70 @@ describe('Search', () => {
|
|||
|
||||
expect(searchResult.rootDirectory).toEqual(root)
|
||||
})
|
||||
|
||||
it('Multi path search - root directory', async () => {
|
||||
const searchPath1 = path.join(root, 'folder-a')
|
||||
const searchPath2 = path.join(root, 'folder-d')
|
||||
|
||||
const searchPaths = searchPath1 + '\n' + searchPath2
|
||||
const searchResult = await findFilesToUpload(searchPaths)
|
||||
|
||||
expect(searchResult.rootDirectory).toEqual(root)
|
||||
expect(searchResult.filesToUpload.length).toEqual(7)
|
||||
expect(searchResult.filesToUpload.includes(searchItem1Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem2Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem2Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem4Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(extraSearchItem1Path)).toEqual(
|
||||
true
|
||||
)
|
||||
expect(searchResult.filesToUpload.includes(extraSearchItem2Path)).toEqual(
|
||||
true
|
||||
)
|
||||
expect(searchResult.filesToUpload.includes(extraFileInFolderCPath)).toEqual(
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
it('Multi path search - with exclude character', async () => {
|
||||
const searchPath1 = path.join(root, 'folder-a')
|
||||
const searchPath2 = path.join(root, 'folder-d')
|
||||
const searchPath3 = path.join(root, 'folder-a', 'folder-b', '**/extra*.txt')
|
||||
|
||||
// negating the third search path
|
||||
const searchPaths = searchPath1 + '\n' + searchPath2 + '\n!' + searchPath3
|
||||
const searchResult = await findFilesToUpload(searchPaths)
|
||||
|
||||
expect(searchResult.rootDirectory).toEqual(root)
|
||||
expect(searchResult.filesToUpload.length).toEqual(5)
|
||||
expect(searchResult.filesToUpload.includes(searchItem1Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem2Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem2Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(searchItem4Path)).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(extraSearchItem2Path)).toEqual(
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
it('Multi path search - non root directory', async () => {
|
||||
const searchPath1 = path.join(root, 'folder-h', 'folder-i')
|
||||
const searchPath2 = path.join(root, 'folder-h', 'folder-j', 'folder-k')
|
||||
const searchPath3 = amazingFileInFolderHPath
|
||||
|
||||
const searchPaths = searchPath1 + '\n' + searchPath2 + '\n' + searchPath3
|
||||
const searchResult = await findFilesToUpload(searchPaths)
|
||||
|
||||
expect(searchResult.rootDirectory).toEqual(path.join(root, 'folder-h'))
|
||||
expect(searchResult.filesToUpload.length).toEqual(4)
|
||||
expect(
|
||||
searchResult.filesToUpload.includes(amazingFileInFolderHPath)
|
||||
).toEqual(true)
|
||||
expect(searchResult.filesToUpload.includes(extraSearchItem4Path)).toEqual(
|
||||
true
|
||||
)
|
||||
expect(searchResult.filesToUpload.includes(extraSearchItem5Path)).toEqual(
|
||||
true
|
||||
)
|
||||
expect(searchResult.filesToUpload.includes(lonelyFilePath)).toEqual(true)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue