Skip to content

Commit 490aa20

Browse files
committed
adding a unittest for empty files
1 parent 7a0006c commit 490aa20

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/common/DBOpsFile.class.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ Describe "DBOpsFile class tests" -Tag UnitTests {
154154
$file.RebuildHash()
155155
$file.Hash | Should -Be $oldHash
156156
}
157+
It "should test RebuildHash method with empty file" {
158+
$emptyFile = New-Item $workFolder\emptyfile.sql -ItemType File
159+
{ [DBOpsFile]::new($emptyFile, 'emptyfile.sql', $true) } | Should -Throw
160+
}
157161
It "should test ValidateHash method" {
158162
$hash = $file.Hash
159163
{ $file.ValidateHash('foo') } | Should -Throw 'File cannot be loaded, hash mismatch*'

0 commit comments

Comments
 (0)