refactor: make this a valid nuget package for Powershell gallery
feat: add build environment scripts
This commit is contained in:
parent
69c2684ee7
commit
46b1b7c83f
38 changed files with 200 additions and 42 deletions
66
tests/PersonalAccessToken.Tests.ps1
Executable file
66
tests/PersonalAccessToken.Tests.ps1
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
BeforeAll {
|
||||
Import-Module (Join-Path $PSScriptRoot '..' 'src' `
|
||||
'PSConfluencePublisher.psd1')
|
||||
|
||||
$mockHost = 'confluence.contoso.com'
|
||||
|
||||
$mockPat = '01234567890123456789'
|
||||
}
|
||||
|
||||
|
||||
Describe 'Register-PersonalAccessToken' `
|
||||
{
|
||||
BeforeEach {
|
||||
Initialize-PersonalAccessTokenStore
|
||||
}
|
||||
|
||||
Context 'Parameterized' {
|
||||
|
||||
It 'throws no exception' {
|
||||
Register-PersonalAccessToken -Host $mockHost -Token $mockPat
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Shorthand' {
|
||||
|
||||
It 'throws no exception' {
|
||||
Register-PersonalAccessToken $mockHost $mockPat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Describe 'Get-PersonalAccessToken' `
|
||||
{
|
||||
BeforeEach {
|
||||
Initialize-PersonalAccessTokenStore
|
||||
}
|
||||
|
||||
Context 'Parameterized' {
|
||||
|
||||
It 'gets an existing PAT' {
|
||||
|
||||
Register-PersonalAccessToken -Host $mockHost -Token $mockPat
|
||||
|
||||
Get-PersonalAccessToken -Host $mockHost | Should -Be $mockPat
|
||||
}
|
||||
|
||||
It 'requires PAT to exist' {
|
||||
|
||||
{Get-PersonalAccessToken -Host $mockHost} | Should -Throw
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Shorthand' {
|
||||
|
||||
It 'throws no exception' {
|
||||
|
||||
Register-PersonalAccessToken -Host $mockHost -Token $mockPat
|
||||
|
||||
Get-PersonalAccessToken $mockHost | Should -Be $mockPat
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue