Skip to content

Commit

Permalink
Converted to function and added initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adbertram committed Mar 14, 2017
1 parent 907633e commit 34b4359
Show file tree
Hide file tree
Showing 2 changed files with 415 additions and 267 deletions.
115 changes: 115 additions & 0 deletions PowerShell Gallery/Publish-PowerShellGalleryModule.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
. .\Publish-PowerShellGalleryModule.ps1

$commandName = 'Publish-PowerShellGalleryModule'

#region Mocks
mock 'Test-Path' {
$true
}

mock 'ShowMenu'

mock 'PromptChoice'

mock 'GetRequiredManifestKeyParams' {
@{
Version = 'ver'
Description = 'desc'
Author = 'authorhere'
ProjectUri = 'urihere'
}
}

mock 'New-ModuleManifest'

mock 'Test-ModuleManifest' {
$true
}

mock 'Add-Content'

mock 'Get-Module' {
@{
Path = 'manifestpath'
Description = 'deschere'
Author = 'authhere'
Version = 'verhere'
LicenseUri = 'licurihere'
}
}

mock 'Update-ModuleManifest'

mock 'Publish-Module'

mock 'Invoke-Test'
#endregion

it 'should run all optional tests if chosen' {
& $commandName -ModuleFilePath 'C:\module.psm1' -RunOptionalTests


}

it 'should run all mandatory tests' {

}

it 'should call Publish-Module with the expected parameters' {

}

context 'When immediately publishing to the PowerShell Gallery' {

it 'should call Publish-Module with the expected parameters' {

}
}

context 'When no NuGet API key is passed' {

it 'throws an exception' {
s
}
}

context 'When no module manifest exists' {

it 'should run the fix action' {

}
}

context 'When a module manifest exists but does not have required keys' {

it 'should run the fix action' {

}
}

context 'When no Pester tests are found' {

it 'should run the fix action' {

}

it 'should create a describe block for each exported module function' {

}
}

context 'When it does not pass Test-ModuleManifest' {

it 'should run the fix action' {

}
}

context 'When the module is not found' {

it 'should throw an exception' {

}
}


Loading

0 comments on commit 34b4359

Please sign in to comment.