@@ -283,7 +283,7 @@ if ($script:accessTokenConfigured)
283
283
Context ' Adding labels to an issue' {
284
284
$labelsToAdd = @ (' pri:lowest' , ' pri:low' , ' pri:medium' , ' pri:high' , ' pri:highest' , ' bug' , ' duplicate' ,
285
285
' enhancement' , ' up for grabs' , ' question' , ' discussion' , ' wontfix' , ' in progress' , ' ready' )
286
- $addedLabels = @ (Add-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName $labelsToAdd )
286
+ $addedLabels = @ (Add-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName $labelsToAdd )
287
287
288
288
It ' Should return the expected number of labels' {
289
289
$addedLabels.Count | Should be $script :defaultLabels.Count
@@ -295,37 +295,69 @@ if ($script:accessTokenConfigured)
295
295
$labelIssues.Count | Should be $script :defaultLabels.Count
296
296
}
297
297
}
298
+
299
+ $null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
298
300
}
299
301
Describe ' Removing labels on an issue' {
302
+ $repositoryName = [Guid ]::NewGuid().Guid
303
+ $null = New-GitHubRepository - RepositoryName $repositoryName
300
304
301
- Remove-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " discussion" - Issue $issue.number
302
- Remove-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " question" - Issue $issue.number
303
- Remove-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " bug" - Issue $issue.number
304
- $labelIssues = Get-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number
305
+ $issueName = [Guid ]::NewGuid().Guid
306
+ $issue = New-GitHubIssue - OwnerName $script :ownerName - RepositoryName $repositoryName - Title $issueName
305
307
306
- It ' Should have added the expected number of labels' {
307
- $labelIssues.Count | Should be ($script :defaultLabels.Count - 3 )
308
+ $labelsToAdd = @ (' pri:lowest' , ' pri:low' , ' pri:medium' , ' pri:high' , ' pri:highest' , ' bug' , ' duplicate' ,
309
+ ' enhancement' , ' up for grabs' , ' question' , ' discussion' , ' wontfix' , ' in progress' , ' ready' )
310
+ Add-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName $labelsToAdd
311
+
312
+ Context ' For removing individual issues' {
313
+ Remove-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " discussion" - Issue $issue.number
314
+ Remove-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " question" - Issue $issue.number
315
+ Remove-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Name " bug" - Issue $issue.number
316
+ $labelIssues = Get-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number
317
+
318
+ It ' Should have added the expected number of labels' {
319
+ $labelIssues.Count | Should be ($script :defaultLabels.Count - 3 )
320
+ }
308
321
}
322
+
323
+ Context ' For removing all issues' {
324
+ Remove-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number
325
+ $labelIssues = Get-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number
326
+
327
+ It ' Should have added the expected number of labels' {
328
+ $labelIssues.Count | Should be 0
329
+ }
330
+ }
331
+
332
+ $null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
309
333
}
310
334
311
335
Describe ' Replacing labels on an issue' {
336
+ $repositoryName = [Guid ]::NewGuid().Guid
337
+ $null = New-GitHubRepository - RepositoryName $repositoryName
338
+
339
+ $issueName = [Guid ]::NewGuid().Guid
340
+ $issue = New-GitHubIssue - OwnerName $script :ownerName - RepositoryName $repositoryName - Title $issueName
341
+
312
342
$labelsToAdd = @ (' pri:lowest' , ' pri:low' , ' pri:medium' , ' pri:high' , ' pri:highest' , ' bug' , ' duplicate' ,
313
343
' enhancement' , ' up for grabs' , ' question' , ' discussion' , ' wontfix' , ' in progress' , ' ready' )
314
344
315
- $addedLabels = @ (Add-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName $labelsToAdd -Replace )
345
+ Add-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName ' pri:medium'
346
+
347
+ $addedLabels = @ (Set-GitHubIssueLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number - LabelName $labelsToAdd )
316
348
317
349
It ' Should return the expected number of labels' {
318
- $addedLabels.Count | Should be $script :defaultLabels .Count
350
+ $addedLabels.Count | Should be $labelsToAdd .Count
319
351
}
320
352
321
353
$labelIssues = Get-GitHubLabel - OwnerName $script :ownerName - RepositoryName $repositoryName - Issue $issue.number
322
354
323
355
It ' Should have added the expected number of labels' {
324
356
$labelIssues.Count | Should be $script :defaultLabels.Count
325
357
}
358
+
359
+ $null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
326
360
}
327
-
328
- $null = Remove-GitHubRepository - OwnerName $script :ownerName - RepositoryName $repositoryName
329
361
}
330
362
331
363
# Restore the user's configuration to its pre-test state
0 commit comments