16
16
$repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
17
17
18
18
Context ' When initially created, there are no issues' {
19
- $issues = Get-GitHubIssue - Uri $repo.svn_url
19
+ $issues = @ ( Get-GitHubIssue - Uri $repo.svn_url )
20
20
21
21
It ' Should return expected number of issues' {
22
- @ ( $issues ) .Count | Should be 0
22
+ $issues.Count | Should be 0
23
23
}
24
24
}
25
25
34
34
$newIssues [0 ] = Update-GitHubIssue - OwnerName $script :ownerName - RepositoryName $repo.name - Issue $newIssues [0 ].number - State Closed
35
35
$newIssues [-1 ] = Update-GitHubIssue - OwnerName $script :ownerName - RepositoryName $repo.name - Issue $newIssues [-1 ].number - State Closed
36
36
37
- $issues = Get-GitHubIssue - Uri $repo.svn_url
37
+ $issues = @ ( Get-GitHubIssue - Uri $repo.svn_url )
38
38
It ' Should return only open issues' {
39
- @ ( $issues ) .Count | Should be 2
39
+ $issues.Count | Should be 2
40
40
}
41
41
42
- $issues = Get-GitHubIssue - Uri $repo.svn_url - State All
42
+ $issues = @ ( Get-GitHubIssue - Uri $repo.svn_url - State All)
43
43
It ' Should return all issues' {
44
- @ ( $issues ) .Count | Should be 4
44
+ $issues.Count | Should be 4
45
45
}
46
46
47
47
$createdOnOrAfterDate = Get-Date - Date $newIssues [0 ].created_at
48
48
$createdOnOrBeforeDate = Get-Date - Date $newIssues [2 ].created_at
49
- $issues = ( Get-GitHubIssue - Uri $repo.svn_url ) | Where-Object { ($_.created_at -ge $createdOnOrAfterDate ) -and ($_.created_at -le $createdOnOrBeforeDate ) }
49
+ $issues = @ (( Get-GitHubIssue - Uri $repo.svn_url ) | Where-Object { ($_.created_at -ge $createdOnOrAfterDate ) -and ($_.created_at -le $createdOnOrBeforeDate ) })
50
50
51
51
It ' Smart object date conversion works for comparing dates' {
52
- @ ( $issues ) .Count | Should be 2
52
+ $issues.Count | Should be 2
53
53
}
54
54
55
55
$createdDate = Get-Date - Date $newIssues [1 ].created_at
56
- $issues = Get-GitHubIssue - Uri $repo.svn_url - State All | Where-Object { ($_.created_at -ge $createdDate ) -and ($_.state -eq ' closed' ) }
56
+ $issues = @ ( Get-GitHubIssue - Uri $repo.svn_url - State All | Where-Object { ($_.created_at -ge $createdDate ) -and ($_.state -eq ' closed' ) })
57
57
58
58
It ' Able to filter based on date and state' {
59
- @ ( $issues ) .Count | Should be 1
59
+ $issues.Count | Should be 1
60
60
}
61
61
}
62
62
88
88
$issueCounts = $issueCounts | Sort-Object - Property Count - Descending
89
89
90
90
It ' Should return expected number of issues for each repository' {
91
- @ ( $issueCounts [0 ].Count) | Should be 3
92
- @ ( $issueCounts [1 ].Count) | Should be 0
91
+ $issueCounts [0 ].Count | Should be 3
92
+ $issueCounts [1 ].Count | Should be 0
93
93
}
94
94
95
95
It ' Should return expected repository names' {
96
- @ ( $issueCounts [0 ].Uri) | Should be ( $repo1.svn_url )
97
- @ ( $issueCounts [1 ].Uri) | Should be ( $repo2.svn_url )
96
+ $issueCounts [0 ].Uri | Should be $repo1.svn_url
97
+ $issueCounts [1 ].Uri | Should be $repo2.svn_url
98
98
}
99
99
}
100
100
101
- $null = Remove-GitHubRepository - Uri ( $repo1.svn_url )
102
- $null = Remove-GitHubRepository - Uri ( $repo2.svn_url )
101
+ $null = Remove-GitHubRepository - Uri $repo1.svn_url
102
+ $null = Remove-GitHubRepository - Uri $repo2.svn_url
103
103
}
104
104
105
105
@@ -186,10 +186,10 @@ try
186
186
$null = New-GitHubRepository - RepositoryName $repositoryName - AutoInit
187
187
$repositoryUrl = " https://github.com/$script :ownerName /$repositoryName "
188
188
189
- $collaborators = Get-GitHubRepositoryCollaborator - Uri $repositoryUrl
189
+ $collaborators = @ ( Get-GitHubRepositoryCollaborator - Uri $repositoryUrl )
190
190
191
191
It ' Should return expected number of collaborators' {
192
- @ ( $collaborators ) .Count | Should be 1
192
+ $collaborators.Count | Should be 1
193
193
}
194
194
195
195
$null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
@@ -201,10 +201,10 @@ try
201
201
$null = New-GitHubRepository - RepositoryName $repositoryName - AutoInit
202
202
$repositoryUrl = " https://github.com/$script :ownerName /$repositoryName "
203
203
204
- $contributors = Get-GitHubRepositoryContributor - Uri $repositoryUrl - IncludeStatistics
204
+ $contributors = @ ( Get-GitHubRepositoryContributor - Uri $repositoryUrl - IncludeStatistics)
205
205
206
206
It ' Should return expected number of contributors' {
207
- @ ( $contributors ) .Count | Should be 1
207
+ $contributors.Count | Should be 1
208
208
}
209
209
210
210
$null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
@@ -242,15 +242,13 @@ try
242
242
}
243
243
244
244
Describe ' Getting repositories from organization' {
245
- <# Temporary hack due to issues with this test in ADO #> . (Join-Path - Path $moduleRootPath - ChildPath ' Tests\Config\Settings.ps1' )
246
-
247
- $original = Get-GitHubRepository - OrganizationName $script :organizationName
245
+ $original = @ (Get-GitHubRepository - OrganizationName $script :organizationName )
248
246
249
247
$repo = New-GitHubRepository - RepositoryName ([guid ]::NewGuid().Guid) - OrganizationName $script :organizationName
250
- $current = Get-GitHubRepository - OrganizationName $script :organizationName
248
+ $current = @ ( Get-GitHubRepository - OrganizationName $script :organizationName )
251
249
252
250
It ' Should return expected number of organization repositories' {
253
- (@ ( $current ) .Count - @ ( $original ) .Count) | Should be 1
251
+ ($current.Count - $original.Count ) | Should be 1
254
252
}
255
253
256
254
$null = Remove-GitHubRepository - Uri $repo.svn_url
@@ -260,15 +258,15 @@ try
260
258
$repositoryName = [guid ]::NewGuid().Guid
261
259
$null = New-GitHubRepository - RepositoryName $repositoryName - AutoInit
262
260
263
- $contributors = Get-GitHubRepositoryContributor - OwnerName $script :ownerName - RepositoryName $repositoryName - IncludeStatistics
261
+ $contributors = @ ( Get-GitHubRepositoryContributor - OwnerName $script :ownerName - RepositoryName $repositoryName - IncludeStatistics)
264
262
265
263
$uniqueContributors = $contributors |
266
264
Select-Object - ExpandProperty author |
267
265
Select-Object - ExpandProperty login - Unique
268
266
Sort-Object
269
267
270
268
It ' Should return expected number of unique contributors' {
271
- @ ( $uniqueContributors ) .Count | Should be 1
269
+ $uniqueContributors.Count | Should be 1
272
270
}
273
271
274
272
$null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
@@ -298,14 +296,14 @@ try
298
296
$repositoryName = [guid ]::NewGuid().Guid
299
297
$null = New-GitHubRepository - RepositoryName $repositoryName - AutoInit
300
298
301
- $branches = Get-GitHubRepositoryBranch - OwnerName $script :ownerName - RepositoryName $repositoryName
299
+ $branches = @ ( Get-GitHubRepositoryBranch - OwnerName $script :ownerName - RepositoryName $repositoryName )
302
300
303
301
It ' Should return expected number of repository branches' {
304
- @ ( $branches ) .Count | Should be 1
302
+ $branches.Count | Should be 1
305
303
}
306
304
307
305
It ' Should return the name of the branches' {
308
- @ ( $branches [0 ].name) | Should be " master"
306
+ $branches [0 ].name | Should be ' master'
309
307
}
310
308
311
309
$null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
0 commit comments