@@ -192,7 +192,7 @@ Describe "Add-DBOBuild tests" -Tag $commandName, UnitTests {
192192 $testResults.Name | Should Be (Split-Path $packageNameTest - Leaf)
193193 Test-Path $packageNameTest | Should Be $true
194194 $scripts = $testResults.GetBuild (' 2.0' ).Scripts
195- Join-PSFPath - Normalize ' content\2.0' ((Resolve-Path $v2scripts - Relative) -replace ' ^\.\\|^\.\/' , ' ' )| Should BeIn $scripts.GetPackagePath ()
195+ Join-PSFPath - Normalize ' content\2.0' ((Resolve-Path $v2scripts - Relative) -replace ' ^\.\\|^\.\/' , ' ' ) | Should BeIn $scripts.GetPackagePath ()
196196 Join-PSFPath - Normalize ' content\2.0\1.sql' | Should Not BeIn $scripts.GetPackagePath ()
197197 $items = Get-ArchiveItem $packageNameTest
198198 Join-PSFPath - Normalize ' content\1.0\1.sql' | Should BeIn $items.Path
@@ -204,7 +204,7 @@ Describe "Add-DBOBuild tests" -Tag $commandName, UnitTests {
204204 $testResults.Name | Should Be (Split-Path $packageNameTest - Leaf)
205205 Test-Path $packageNameTest | Should Be $true
206206 $scripts = $testResults.GetBuild (' 2.0' ).Scripts
207- Join-PSFPath - Normalize ' content\2.0' ($v2scripts -replace ' :' , ' ' )| Should BeIn $scripts.GetPackagePath ()
207+ Join-PSFPath - Normalize ' content\2.0' ($v2scripts -replace ' :' , ' ' ) | Should BeIn $scripts.GetPackagePath ()
208208 Join-PSFPath - Normalize ' content\2.0\1.sql' | Should Not BeIn $scripts.GetPackagePath ()
209209 $items = Get-ArchiveItem $packageNameTest
210210 Join-PSFPath - Normalize ' content\1.0\1.sql' | Should BeIn $items.Path
@@ -242,6 +242,22 @@ Describe "Add-DBOBuild tests" -Tag $commandName, UnitTests {
242242 Join-PSFPath - Normalize ' content\2.0\2.sql' | Should BeIn $items.Path
243243 Join-PSFPath - Normalize ' content\2.0\3.sql' | Should Not BeIn $items.Path
244244 }
245+ It " Should add only matched files from a recursive folder" {
246+ $testResults = Add-DBOBuild - ScriptPath $noRecurseFolder \* - Name $packageNameTest - Build 2.0 -Match ' 2\.sql'
247+ $testResults | Should Not Be $null
248+ $testResults.Name | Should Be (Split-Path $packageNameTest - Leaf)
249+ Test-Path $packageNameTest | Should Be $true
250+ $scripts = $testResults.GetBuild (' 2.0' ).Scripts
251+ $scripts | Should -Not - BeNullOrEmpty
252+ Join-PSFPath - Normalize ' content\2.0\success\1.sql' | Should Not BeIn $scripts.GetPackagePath ()
253+ Join-PSFPath - Normalize ' content\2.0\success\2.sql' | Should BeIn $scripts.GetPackagePath ()
254+ Join-PSFPath - Normalize ' content\2.0\success\3.sql' | Should Not BeIn $scripts.GetPackagePath ()
255+ $items = Get-ArchiveItem $packageNameTest
256+ Join-PSFPath - Normalize ' content\1.0\1.sql' | Should BeIn $items.Path
257+ Join-PSFPath - Normalize ' content\2.0\success\1.sql' | Should Not BeIn $items.Path
258+ Join-PSFPath - Normalize ' content\2.0\success\2.sql' | Should BeIn $items.Path
259+ Join-PSFPath - Normalize ' content\2.0\success\3.sql' | Should Not BeIn $items.Path
260+ }
245261 }
246262 Context " negative tests" {
247263 BeforeAll {
@@ -267,7 +283,7 @@ Describe "Add-DBOBuild tests" -Tag $commandName, UnitTests {
267283 $errorResult.Exception.Message -join ' ;' | Should BeLike ' *Incorrect package format*'
268284 }
269285 It " should throw error when package zip does not exist" {
270- { Add-DBOBuild - Name " .\nonexistingpackage.zip" - ScriptPath $v1scripts - ErrorAction Stop} | Should Throw
286+ { Add-DBOBuild - Name " .\nonexistingpackage.zip" - ScriptPath $v1scripts - ErrorAction Stop } | Should Throw
271287 }
272288 It " should throw error when path cannot be resolved" {
273289 try {
0 commit comments