Skip to content

Commit 4030361

Browse files
Minor test cleanup (#126)
Adopting `$PSScriptRoot` to simplify path access, and making a minor code simplification in a test.
1 parent 8da84fd commit 4030361

9 files changed

+11
-11
lines changed

Tests/GitHubAnalytics.tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try
@@ -245,14 +245,14 @@ try
245245
$original = Get-GitHubRepository -OrganizationName $script:organizationName
246246

247247
$repositoryName = [guid]::NewGuid().Guid
248-
$null = New-GitHubRepository -RepositoryName $repositoryName -OrganizationName $script:organizationName
248+
$repo = New-GitHubRepository -RepositoryName ([guid]::NewGuid().Guid) -OrganizationName $script:organizationName
249249
$current = Get-GitHubRepository -OrganizationName $script:organizationName
250250

251251
It 'Should return expected number of organization repositories' {
252252
(@($current).Count - @($original).Count) | Should be 1
253253
}
254254

255-
$null = Remove-GitHubRepository -OwnerName $script:organizationName -RepositoryName $repositoryName
255+
$null = Remove-GitHubRepository -Uri $repo.svn_url
256256
}
257257

258258
Describe 'Getting unique contributors from contributors array' {

Tests/GitHubAssignees.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubComments.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubCore.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubEvents.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubLabels.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubMilestones.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubRepositoryForks.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

Tests/GitHubRepositoryTraffic.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#>
88

99
# This is common test code setup logic for all Pester test files
10-
$moduleRootPath = Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)
10+
$moduleRootPath = Split-Path -Path $PSScriptRoot -Parent
1111
. (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1')
1212

1313
try

0 commit comments

Comments
 (0)