mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Invoke-Item tests added
This commit is contained in:
1 parent
eec3b334cc
commit
61a6713f4c
1 file changed
+46
@@ -0,0 +1,46 @@
|
||||
function Clean-State
|
||||
{
|
||||
if (Test-Path $FullyQualifiedLink)
|
||||
{
|
||||
Remove-Item $FullyQualifiedLink -Force
|
||||
}
|
||||
|
||||
if (Test-Path $FullyQualifiedFile)
|
||||
{
|
||||
Remove-Item $FullyQualifiedFile -Force
|
||||
}
|
||||
|
||||
if (Test-Path $FullyQualifiedFolder)
|
||||
{
|
||||
Remove-Item $FullyQualifiedFolder -Force
|
||||
}
|
||||
}
|
||||
|
||||
Describe "New-Item" {
|
||||
$tmpDirectory = $TestDrive
|
||||
$testfile = "testfile.txt"
|
||||
$testfolder = "newDirectory"
|
||||
$testlink = "testlink"
|
||||
$FullyQualifiedFile = Join-Path -Path $tmpDirectory -ChildPath $testfile
|
||||
$FullyQualifiedFolder = Join-Path -Path $tmpDirectory -ChildPath $testfolder
|
||||
$FullyQualifiedLink = Join-Path -Path $tmpDirectory -ChildPath $testlink
|
||||
|
||||
BeforeEach {
|
||||
Clean-State
|
||||
}
|
||||
|
||||
It "Should call the function without error" {
|
||||
{
|
||||
New-Item -Name $testfile -Path $tmpDirectory -ItemType file } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Should invoke a text file without error" {
|
||||
New-Item -Name $testfile -Path $tmpDirectory -ItemType file
|
||||
Test-Path $FullyQualifiedFile | Should Be $true
|
||||
$fileInfo = Get-ChildItem $FullyQualifiedFile
|
||||
$fileInfo.Target | Should Be $null
|
||||
$fileInfo.LinkType | Should Be $null
|
||||
Invoke-Item $FullyQualifiedFile | Should Not throw
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user