382
382
}
383
383
384
384
It ' Should return objects of the correct type' {
385
- $publicRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
386
- $privateRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
385
+ $publicRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
386
+ $privateRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
387
387
}
388
388
389
389
It " Should return the correct membership" {
403
403
}
404
404
405
405
It ' Should return objects of the correct type' {
406
- $publicRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
407
- $publicRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
408
- $ownerRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
406
+ $publicRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
407
+ $publicRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
408
+ $ownerRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
409
409
}
410
410
411
411
It " Should return the correct membership" {
426
426
}
427
427
428
428
It ' Should return objects of the correct type' {
429
- $ownerRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
429
+ $ownerRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
430
430
}
431
431
432
432
It " Should return the correct membership" {
448
448
}
449
449
450
450
It ' Should return objects of the correct type' {
451
- $sortedRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
452
- $sortedDescendingRepos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
451
+ $sortedRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
452
+ $sortedDescendingRepos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
453
453
}
454
454
455
455
It " Should return the correct membership order" {
525
525
}
526
526
527
527
It ' Should return an object of the correct type' {
528
- $repos.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Repository'
528
+ $repos [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.Repository'
529
529
}
530
530
531
531
It ' Should return at least one result' {
956
956
}
957
957
958
958
It ' Should return an object of the correct type' {
959
- $topic.PSObject.TypeNames [0 ] | Should - Be ' GitHub.Topic '
959
+ $topic.PSObject.TypeNames [0 ] | Should - Be ' GitHub.RepositoryTopic '
960
960
}
961
961
962
962
It ' Should return the correct properties' {
988
988
$contributors.PSObject.TypeNames [0 ] | Should - Be ' GitHub.User'
989
989
}
990
990
991
- It ' Should return at least one result ' {
992
- $contributors.count | Should - BeGreaterOrEqual 1
991
+ It ' Should return expected number of contributors ' {
992
+ $contributors.Count | Should - Be 1
993
993
}
994
994
995
995
It " Should return the correct membership" {
@@ -1008,11 +1008,12 @@ try
1008
1008
}
1009
1009
1010
1010
It ' Should return objects of the correct type' {
1011
- $contributors.PSObject.TypeNames [0 ] | Should - Be ' GitHub.User'
1011
+ $contributors [0 ].PSObject.TypeNames[0 ] | Should - Be ' GitHub.RepositoryContributorStatistics'
1012
+ $contributors [0 ].author.PSObject.TypeNames[0 ] = ' GitHub.User'
1012
1013
}
1013
1014
1014
- It ' Should return at least one result ' {
1015
- $contributors.count | Should - BeGreaterOrEqual 1
1015
+ It ' Should return expected number of contributors ' {
1016
+ $contributors.Count | Should - Be 1
1016
1017
}
1017
1018
1018
1019
It ' Should return the correct membership' {
@@ -1068,11 +1069,29 @@ try
1068
1069
}
1069
1070
1070
1071
It ' Should return objects of the correct type' {
1071
- $collaborators.PSObject.TypeNames [0 ] | Should - Be ' GitHub.User'
1072
+ $collaborators [ 0 ] .PSObject.TypeNames[0 ] | Should - Be ' GitHub.User'
1072
1073
}
1073
1074
1074
- It ' Should return at least one result' {
1075
- $collaborators.count | Should - BeGreaterOrEqual 1
1075
+ It ' Should return expected number of collaborators' {
1076
+ $collaborators.Count | Should - Be 1
1077
+ }
1078
+
1079
+ It " Should return the correct membership" {
1080
+ $repo.owner.login | Should - BeIn $collaborators.login
1081
+ }
1082
+ }
1083
+
1084
+ Context ' When getting GitHub Repository Collaborators (via pipeline)' {
1085
+ BeforeAll {
1086
+ $collaborators = @ ($repo | Get-GitHubRepositoryCollaborator )
1087
+ }
1088
+
1089
+ It ' Should return objects of the correct type' {
1090
+ $collaborators [0 ].PSObject.TypeNames[0 ] | Should - Be ' GitHub.User'
1091
+ }
1092
+
1093
+ It ' Should return expected number of collaborators' {
1094
+ $collaborators.Count | Should - Be 1
1076
1095
}
1077
1096
1078
1097
It " Should return the correct membership" {
@@ -1139,72 +1158,6 @@ try
1139
1158
}
1140
1159
}
1141
1160
1142
- Describe ' Contributors for a repository' {
1143
- BeforeAll {
1144
- $repo = New-GitHubRepository - RepositoryName ([guid ]::NewGuid().Guid) - AutoInit
1145
- }
1146
-
1147
- AfterAll {
1148
- $null = Remove-GitHubRepository - Uri $repo.RepositoryUrl - Confirm:$false
1149
- }
1150
-
1151
- Context - Name ' Obtaining contributors for repository' - Fixture {
1152
- $contributors = @ (Get-GitHubRepositoryContributor - Uri $repo.RepositoryUrl )
1153
-
1154
- It ' Should return expected number of contributors' {
1155
- $contributors.Count | Should - Be 1
1156
- $contributors [0 ].PSObject.TypeNames[0 ] = ' GitHub.RepositoryContributor'
1157
- }
1158
- }
1159
-
1160
- Context - Name ' Obtaining contributors for repository (via pipeline)' - Fixture {
1161
- $contributors = @ ($repo | Get-GitHubRepositoryContributor - IncludeStatistics)
1162
-
1163
- It ' Should return expected number of contributors' {
1164
- $contributors.Count | Should - Be 1
1165
- $contributors [0 ].PSObject.TypeNames[0 ] = ' GitHub.RepositoryContributor'
1166
- }
1167
- }
1168
-
1169
- Context - Name ' Obtaining contributor statistics for repository' - Fixture {
1170
- $stats = @ (Get-GitHubRepositoryContributor - Uri $repo.RepositoryUrl - IncludeStatistics)
1171
-
1172
- It ' Should return expected number of contributors' {
1173
- $stats.Count | Should - Be 1
1174
- $stats [0 ].PSObject.TypeNames[0 ] = ' GitHub.RepositoryContributorStatistics'
1175
- $stats [0 ].author.PSObject.TypeNames[0 ] = ' GitHub.User'
1176
- }
1177
- }
1178
- }
1179
-
1180
- Describe ' Collaborators for a repository' {
1181
- BeforeAll {
1182
- $repo = New-GitHubRepository - RepositoryName ([guid ]::NewGuid().Guid) - AutoInit
1183
- }
1184
-
1185
- AfterAll {
1186
- $null = Remove-GitHubRepository - Uri $repo.RepositoryUrl - Confirm:$false
1187
- }
1188
-
1189
- Context - Name ' Obtaining collaborators for repository' - Fixture {
1190
- $collaborators = @ (Get-GitHubRepositoryCollaborator - Uri $repo.RepositoryUrl )
1191
-
1192
- It ' Should return expected number of collaborators' {
1193
- $collaborators.Count | Should - Be 1
1194
- $collaborators [0 ].PSObject.TypeNames[0 ] = ' GitHub.RepositoryCollaborator'
1195
- }
1196
- }
1197
-
1198
- Context - Name ' Obtaining collaborators for repository (via pipeline)' - Fixture {
1199
- $collaborators = @ ($repo | Get-GitHubRepositoryCollaborator )
1200
-
1201
- It ' Should return expected number of collaborators' {
1202
- $collaborators.Count | Should - Be 1
1203
- $collaborators [0 ].PSObject.TypeNames[0 ] = ' GitHub.RepositoryCollaborator'
1204
- }
1205
- }
1206
- }
1207
-
1208
1161
Describe ' GitHubRepositories\Test-GitHubRepositoryVulnerabilityAlert' {
1209
1162
BeforeAll - ScriptBlock {
1210
1163
$repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid)
0 commit comments