Skip to content

Commit

Permalink
Reviewable edits
Browse files Browse the repository at this point in the history
  • Loading branch information
phbits committed Jun 25, 2021
1 parent 4d95dab commit 4c83c25
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
17 changes: 8 additions & 9 deletions source/Public/Publish-WikiContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,17 @@ function Publish-WikiContent
Write-Verbose -Message $script:localizedData.CreateTempDirMessage

$tempPath = New-TempFolder
$wikiRepoName = "https://github.com/$OwnerName/$RepositoryName.wiki.git"

try
{
$wikiRepoName = "https://github.com/$OwnerName/$RepositoryName.wiki.git"
Write-Verbose -Message $script:localizedData.ConfigGlobalGitMessage

if ($PSBoundParameters.ContainsKey('GlobalCoreAutoCrLf'))
{
$null = Invoke-Git -WorkingDirectory $tempPath.FullName `
-Arguments @( 'config', '--global', 'core.autocrlf', $GlobalCoreAutoCrLf )
}

Write-Verbose -Message ($script:localizedData.CloneWikiGitRepoMessage -f $WikiRepoName)

Expand All @@ -113,14 +120,6 @@ function Publish-WikiContent

if ($gitCloneResult.ExitCode -eq 0)
{
Write-Verbose -Message $script:localizedData.ConfigGlobalGitMessage

if ($PSBoundParameters.ContainsKey('GlobalCoreAutoCrLf'))
{
$null = Invoke-Git -WorkingDirectory $tempPath.FullName `
-Arguments @( 'config', '--local', 'core.autocrlf', $GlobalCoreAutoCrLf )
}

$copyWikiFileParameters = @{
Path = $Path
DestinationPath = $tempPath
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/public/Publish-WikiContent.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ InModuleScope $script:moduleName {
Assert-MockCalled -CommandName Remove-Item -Exactly -Times 1 -Scope It
}
}

Context 'When publishing Wiki content' {
BeforeAll {
Mock -CommandName Copy-WikiFolder
Expand Down Expand Up @@ -267,11 +268,11 @@ InModuleScope $script:moduleName {
'StandardError' = 'Standard Error 1'
}
} -ParameterFilter {
$Arguments[0] -eq 'commit' -and
$Arguments[1] -eq '--message' -and
$Arguments[2] -eq "`"$($localizedData.UpdateWikiCommitMessage -f $ModuleVersion)`"" -and
$Arguments[3] -eq '--quiet'
}
$Arguments[0] -eq 'commit' -and
$Arguments[1] -eq '--message' -and
$Arguments[2] -eq "`"$($localizedData.UpdateWikiCommitMessage -f $ModuleVersion)`"" -and
$Arguments[3] -eq '--quiet'
}
}

It 'Should not throw an exception and call the expected mocks' {
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/tasks/Publish_GitHub_Wiki_Content.build.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ Describe 'Publish_GitHub_Wiki_Content' {
'StandardError' = 'Standard Error 0'
}
} -ParameterFilter {
$Arguments[0] -eq 'remote' -and
$Arguments[1] -eq 'get-url' -and
$Arguments[2] -eq 'origin'
}
$Arguments[0] -eq 'remote' -and
$Arguments[1] -eq 'get-url' -and
$Arguments[2] -eq 'origin'
}

Mock -Command Get-BuiltModuleVersion -MockWith {
return [PSCustomObject]@{
Expand Down Expand Up @@ -113,10 +113,10 @@ Describe 'Publish_GitHub_Wiki_Content' {
'StandardError' = 'fatal: not a git repository (or any of the parent directories): .git'
}
} -ParameterFilter {
$Arguments[0] -eq 'remote' -and
$Arguments[1] -eq 'get-url' -and
$Arguments[2] -eq 'origin'
}
$Arguments[0] -eq 'remote' -and
$Arguments[1] -eq 'get-url' -and
$Arguments[2] -eq 'origin'
}
}

AfterAll {
Expand Down

0 comments on commit 4c83c25

Please sign in to comment.